Secure RPC
AZTP provides secure RPC (Remote Procedure Call) capabilities for authenticated agent-to-agent communication.
Understanding Secure RPC
In AZTP, secure RPC:
- Authenticates both caller and target agents
- Verifies trust domain relationships
- Enforces policy checks
- Provides audit trails
RPC Flow
When an agent makes a secure call:
- Caller's identity is verified
- Target's identity is verified
- Policy is checked
- Call is executed
- Events are logged
Best Practices
-
Target Identification
- Use consistent target IDs
- Include environment in ID
- Follow SPIFFE ID patterns
-
Action Naming
- Use descriptive action names
- Follow a consistent pattern
- Match policy rules
-
Error Handling
- Handle authentication failures
- Handle policy denials
- Handle network issues
Common Patterns
Basic RPC Call
// Make a secure call to another agent
const result = await securedAgent.secureCall(
'finance-agent', // Target agent ID
'calculate-tax', // Action to perform
{ amount: 1000 } // Payload data
);
Environment-Aware Calls
// Development setup
const devResult = await securedAgent.secureCall(
'dev/finance-agent',
'calculate-tax',
{ amount: 1000 }
);
Error Handling Pattern
try {
const result = await securedAgent.secureCall(
'finance-agent',
'calculate-tax',
{ amount: 1000 }
);
} catch (error) {
if (error.code === 'IDENTITY_ERROR') {
// Handle identity verification failure
} else if (error.code === 'POLICY_DENIED') {
// Handle policy denial
} else {
// Handle other errors
}
}