PRC-Agent Contracts
A PRC-Agent is an autonomous, on-chain agent with a stable identity, a declared set of capabilities, and a single execute(task) entry point. This page documents the reference implementation and two example agents. For the standard itself, see PRC-Agent; for the broader design, see AI Agents.
| Contract | Purpose |
|---|---|
| PRCAgent | Self-contained reference implementation with identity, capabilities, and task execution. |
| TradingAgent | Example agent that executes buy/sell trading tasks and logs positions. |
| DataLabelingAgent | Example agent that labels data points and maintains a labeled dataset. |
The two example agents are deployable from the playground (AI Agents category). Each has an in-editor tutorial.
The common shape
Every PRC-Agent shares the same core state and entry point:
class State:
agent_id: str # ctx.contract_address -- the agent's identity
owner: str # who deployed it
capabilities: list # what it's allowed to do
active: bool # can it accept tasks?
@call
def execute(self, ctx, task: dict) -> dict:
...
Agents identify themselves by their own contract address, declare capabilities at construction, and expose lifecycle control (revoke) to the owner. All task handling flows through execute(task), where the task dict shape is agent-specific.
PRCAgent (reference implementation)
The reference PRCAgent supports a fixed capability vocabulary: inference, training, data_access, cross_contract. Capabilities passed at construction are filtered to this set.
Methods
| Method | Kind | Description |
|---|---|---|
__init__(agent_uri, capabilities) | constructor | Registers the agent, filtering capabilities to the valid set. Emits AgentRegistered. |
register(agent_uri, capabilities) | call | Owner re-registers/updates the agent. Emits AgentUpdated. Returns the agent id. |
bind_capability(capability) | call | Owner adds a capability. Emits CapabilityBound. |
execute(task) | call | Runs a task whose type must be one of the agent's capabilities. Logs it (last 100). Emits TaskExecuted. Returns {"status": "completed", "task_id", "agent_id"}. |
revoke() | call | Owner deactivates the agent. Emits AgentRevoked. |
get_agent() | query | Full profile: id, owner, uri, capabilities, active, task_count. |
get_capabilities() | query | The capability list. |
get_execution_log() | query | Recent execution log entries. |
A task like {"type": "inference", "input": [1, 2, 3]} is accepted only if the agent declared the inference capability; otherwise it raises.
TradingAgent (example)
TradingAgent accepts buy/sell tasks and keeps an auditable position log.
- Capabilities:
["inference", "data_access"] - Task shape:
{"action": "buy"|"sell", "asset": str, "amount": float}
| Method | Kind | Description |
|---|---|---|
__init__(strategy="momentum") | constructor | Registers the agent. Emits AgentRegistered. |
execute(task) | call | Validates the action, records a position (capped at 1000), increments total_trades. Emits TradeExecuted. Returns {"trade_id", "status": "executed"}. |
revoke() | call | Owner deactivates the agent. |
get_agent() | query | Agent profile with total_trades. |
get_capabilities() | query | The capability list. |
get_positions(limit=50) | query | The most recent positions, each with trade_id, action, asset, amount, block. |
An invalid action or a missing asset reverts. Because the log is on-chain, anyone can audit the agent's full trading history.
DataLabelingAgent (example)
DataLabelingAgent labels data points, either from an explicit label (supervised) or heuristically.
- Capabilities:
["inference", "training"] - Task shape:
{"data_id": str, "features": list, "label": str}
When label is empty, the agent assigns "positive" if avg(features) > 0, else "negative" (or "unknown" if no features).
| Method | Kind | Description |
|---|---|---|
__init__(model_uri="") | constructor | Registers the agent. Emits AgentRegistered. |
execute(task) | call | Stores a label (explicit or heuristic) with a features hash, labeler, and block. Emits DataLabeled. Returns {"data_id", "label", "status": "labeled"}. |
revoke() | call | Owner deactivates the agent. |
get_agent() | query | Agent profile with label_count. |
get_capabilities() | query | The capability list. |
get_label(data_id) | query | The stored label record for a data point. |
get_label_count() | query | Total labels stored. |
Re-labeling the same data_id overwrites the previous label — useful for corrections.
Verifiability
Every execute transaction runs inside the deterministic PandaVM and produces a receipt. Because identical inputs against identical state yield identical outputs, any node can re-execute a past task and confirm the result. This is what makes an on-chain agent auditable rather than a black box.
Try it
- Playground: open the Playground, choose Trading Agent (PRC-Agent) or Data Labeling Agent (PRC-Agent) under AI Agents, and follow the tutorial.
- Standard: the PRC-Agent page defines the interface.
- Ecosystem: see AI Agents and the Data Labeling Marketplace.