Client¶
agent_assembly.client.GatewayClient is the HTTP client that talks to the governance gateway. It is created by init_assembly() and exposed as AssemblyContext.client for cases where user code needs to issue ad-hoc gateway calls outside the framework adapter path.
agent_assembly.client.GatewayClient¶
agent_assembly.client.GatewayClient ¶
GatewayClient(
gateway_url: str,
agent_id: str,
api_key: str | None = None,
timeout: int = 30,
*,
parent_agent_id: str | None = None,
team_id: str | None = None,
delegation_reason: str | None = None,
spawned_by_tool: str | None = None,
depth: int | None = None,
enforcement_mode: str | None = None,
)
Client for communicating with the Agent Assembly governance gateway.
| PARAMETER | DESCRIPTION |
|---|---|
gateway_url
|
URL of the governance gateway
TYPE:
|
agent_id
|
Unique identifier for the agent
TYPE:
|
api_key
|
Optional API key for authentication
TYPE:
|
timeout
|
Request timeout in seconds
TYPE:
|
parent_agent_id
|
Parent agent ID for topology tracking
TYPE:
|
team_id
|
Team ID this agent belongs to
TYPE:
|
delegation_reason
|
Human-readable reason for delegation
TYPE:
|
spawned_by_tool
|
Name of the tool that spawned this agent
TYPE:
|
depth
|
Spawn depth in the agent lineage tree
TYPE:
|
enforcement_mode
|
Per-agent governance posture sent to the gateway
at registration.
TYPE:
|
Source code in agent_assembly/client/gateway.py
close ¶
register_agent
async
¶
Register the agent with the governance gateway.
| RETURNS | DESCRIPTION |
|---|---|
dict
|
Registration response data |
| RAISES | DESCRIPTION |
|---|---|
GatewayError
|
If registration fails |
Source code in agent_assembly/client/gateway.py
check_policy_compliance
async
¶
Check if an action complies with governance policies.
| PARAMETER | DESCRIPTION |
|---|---|
action
|
The action to check
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict
|
Policy compliance response |
| RAISES | DESCRIPTION |
|---|---|
GatewayError
|
If policy check fails |
Source code in agent_assembly/client/gateway.py
report_edge ¶
report_edge(
source_agent_id: str,
target_agent_id: str,
edge_type: str,
metadata: dict | None = None,
) -> dict
Report a directed edge between two agents to the topology store.
| PARAMETER | DESCRIPTION |
|---|---|
source_agent_id
|
ID of the source agent
TYPE:
|
target_agent_id
|
ID of the target agent
TYPE:
|
edge_type
|
Semantic type of the edge (e.g. "messages", "delegates_to")
TYPE:
|
metadata
|
Optional freeform metadata to attach to the edge
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict
|
Response data containing the assigned edge id |
| RAISES | DESCRIPTION |
|---|---|
GatewayError
|
If the request fails |
Source code in agent_assembly/client/gateway.py
dispatch_tool
async
¶
Dispatch a tool with placeholder-form args (AAASM-1920 Secret Injection).
The gateway resolves every ${NAME} placeholder in args against
its registered SecretsStore, emits a placeholder-form audit entry,
and returns the resolved args plus the list of substituted names.
The LLM never observes the resolved credential value: the agent code holds the placeholder, Assembly resolves it on the gateway side, and the response is forwarded to the tool sink only.
| PARAMETER | DESCRIPTION |
|---|---|
tool_name
|
Name of the tool to dispatch (e.g.
TYPE:
|
args
|
Placeholder-form args. May contain
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
DispatchToolResult
|
|
DispatchToolResult
|
placeholder names that were substituted. |
| RAISES | DESCRIPTION |
|---|---|
GatewayError
|
If the request fails for any reason — including a
422 Unprocessable Entity when |