foundry-temporal-agents
Temporal activities and clients for calling Strands agents from workflows,
over the A2A (Agent-to-Agent) JSON-RPC protocol or the Query REST API.
Depends on:
foundry-temporal.
Install
Install a released wheel from this repo's GitHub Releases. See Adopting these packages for the full flow - installing from a release tag for evaluation, or hosting the wheel in your own index for production, plus verifying the SBOM.
Quickstart
Register call_strands_agent on your worker, then call it by name:
from datetime import timedelta
from temporalio import workflow
with workflow.unsafe.imports_passed_through():
from foundry_temporal_agents.retry import STRANDS_AGENT_RETRY_POLICY
@workflow.defn
class AgentWorkflow:
@workflow.run
async def run(self, agent_url: str, task: str) -> dict:
result = await workflow.execute_activity(
"call_strands_agent",
args=[agent_url, task, {}, None],
start_to_close_timeout=timedelta(minutes=5),
retry_policy=STRANDS_AGENT_RETRY_POLICY,
heartbeat_timeout=timedelta(seconds=60),
)
return {"result": result}
What's in the box
| Surface | Highlights |
|---|---|
| A2A interface | call_strands_agent activity, strands_agent_activity decorator, StrandsAgentClient |
| Query interface | call_strands_query activity, strands_query_activity decorator, StrandsQueryClient |
| Dataclass activities | call_strands_agent_dataclass, call_strands_query_dataclass, and matching decorators |
| Discovery | AgentCapabilityChecker, AgentRegistry |
| Retry policies | STRANDS_AGENT_RETRY_POLICY, STRANDS_LONG_OPERATION_RETRY_POLICY, get_strands_retry_policy (foundry_temporal_agents.retry) |
| Exceptions | StrandsAgentError and subclasses, including AgentAuthenticationError |
Security
- Bearer authentication: A2A and Query requests send
Authorization: Bearer <token>whenFOUNDRY_AGENT_BEARER_TOKENis set. A401/403fails the activity without retrying. - TLS posture: activities build their TLS context from
FOUNDRY_TLS_MODE(platformby default,offas an alias forplatform,tls, ormtls; TLS 1.2 minimum). See the README's TLS section. - Capability checks: when configured, the capability-discovery request is sent without the bearer token or TLS context.