PRC-Agent: On-Chain AI Agent Standard
Status: Draft
Category: Smart Contract Standard
Copyright
Copyright and related rights waived via CC0.
Simple Summary
A standard interface for AI agents on Panda: on-chain contracts that hold an identity, declare a set of capabilities, accept structured tasks, and execute them deterministically. The standard draws inspiration from ERC-8004 and adapts it to Panda's native Python contract environment.
Abstract
PRC-Agent defines how an AI agent contract exposes its identity, declares the capabilities it supports, accepts tasks, and manages its lifecycle. An agent is identified by its contract address, owned by its deployer, and gated by a fixed set of capabilities. Because Panda natively executes Python deterministically, every task execution is reproducible: any node can re-run the same call data against the same contract state and obtain identical output. The reference implementation is self-contained; for production use it composes with the identity, reputation, and validation registries.
Motivation
The intersection of AI and blockchain today is mostly off-chain inference with on-chain attestation -- opaque and unverifiable. Panda executes contract logic deterministically in the VM, so an agent's task processing is reproducible by any node. A standard agent interface lets:
- Marketplaces list and discover agents by capability
- Users submit tasks to agents that hold the matching capability
- Developers compose agents with the identity, reputation, and validation registries
- Auditors verify any past execution by replaying the transaction
Specification
Conventions
| Concept | Panda type |
|---|---|
| Account / address | str |
| Agent identity | str (the contract address) |
| Capability | str (one of the four valid values) |
| Task | dict (must carry a type key) |
| Task result | dict |
| State-changing | @call |
| Read-only | @query |
| Errors | raise |
Capabilities
An agent declares which of the following four capabilities it supports. Any value outside this set is rejected (filtered out at registration, or raised by bind_capability):
| Capability | Meaning |
|---|---|
inference | Agent can perform ML inference |
training | Agent can perform model training |
data_access | Agent can access external data feeds |
cross_contract | Agent can call other contracts |
The iprc_agent module exports these as CAPABILITY_INFERENCE, CAPABILITY_TRAINING, CAPABILITY_DATA_ACCESS, CAPABILITY_CROSS_CONTRACT, and ALL_CAPABILITIES.
Agent lifecycle
deploy(agent_uri, capabilities)
--> agent is live, owned by deployer, accepting tasks for its capabilities
execute(task) # task["type"] must be a held capability
--> task_id assigned, execution logged, TaskExecuted emitted
bind_capability(cap) # owner adds a capability
register(agent_uri, capabilities) # owner re-registers / updates
revoke() # owner deactivates; execute then fails
Required methods
Implementations MUST provide all six methods below. The validate_prc_agent(cls) helper in iprc_agent.py checks that each one is present and callable, and raises ValueError listing any that are missing.
Constructor
deploy(ctx, agent_uri: str, capabilities: list)Registers the agent. Setsagent_idtoctx.contract_address, records the deployer asowner, storesagent_uri, filterscapabilitiesto the four valid values, activates the agent, and emits AgentRegistered.
Calls
-
register(ctx, agent_uri: str, capabilities: list) -> strRe-registers or updates the agent (owner only). Replaces the URI and capability set, re-activates, emits AgentUpdated, and returns theagent_id. -
bind_capability(ctx, capability: str) -> boolAdds a single capability (owner only). RaisesValueErrorfor an unknown capability; emits CapabilityBound when a new capability is added. ReturnsTrue. -
execute(ctx, task: dict) -> dictExecutes a task. The agent MUST be active, andtask["type"](default"inference") MUST be a held capability, otherwise it raises. Increments the task counter, appends to the execution log (capped at 100 entries), emits TaskExecuted, and returns{"status": "completed", "task_id": ..., "agent_id": ...}. -
revoke(ctx) -> boolDeactivates the agent (owner only). Emits AgentRevoked. ReturnsTrue.
Queries
-
get_agent() -> dictReturns{agent_id, owner, uri, capabilities, active, task_count}. -
get_capabilities() -> listReturns the agent's capability list. -
get_execution_log() -> list(reference extension) Returns recent execution-log entries.
Events
AgentRegistered
MUST fire from the constructor when the agent is deployed.
agent_id: strowner: struri: strcapabilities: list
AgentUpdated
MUST fire when the agent is re-registered via register.
agent_id: struri: strcapabilities: list
CapabilityBound
MUST fire when a new capability is bound.
agent_id: strcapability: str
TaskExecuted
MUST fire when a task is executed.
agent_id: strtask_id: strtask_type: strsender: str
AgentRevoked
MUST fire when the agent is deactivated.
agent_id: str
Notes
- Determinism: Panda executes contracts deterministically, so any node can re-run the same
executecall data against the same contract state and obtain identical output and events. - Composability: For reputation and third-party validation, compose the agent with
AgentIdentityRegistry,AgentReputationRegistry, andAgentValidationRegistry. Agents can also call other contracts when they hold thecross_contractcapability. - Caller-side handle: The
panda.AgentSDK type wraps cross-contract calls into an agent that exposes acomplete(prompt) -> strmethod (see the Agents guide). It is distinct from this on-chain task interface.
Implementation
Reference contract: contracts/agents/prc_agent.py. Interface and validator: contracts/agents/iprc_agent.py.
panda deploy contracts/agents/prc_agent.py \
--rpc http://localhost:8545 \
--args '{"agent_uri":"https://example.com/agent.json","capabilities":["inference","data_access"]}'
After deployment, submit a task whose type matches a held capability:
panda call <agent-address> execute \
--args '{"task":{"type":"inference","input":[1,2,3]}}'
The agent returns {"status":"completed","task_id":"task_1","agent_id":"<address>"} and emits a TaskExecuted event.
History
- Builds on the agent identity / reputation / validation registries (ERC-8004 inspired).
- Inspired by the AI agent + blockchain convergence (2025-2026).
Citation
Panda Protocol. PRC-Agent: On-Chain AI Agent Standard. Panda documentation:
docs/PRC-Agent.md.