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

ConceptPanda type
Account / addressstr
Agent identitystr (the contract address)
Capabilitystr (one of the four valid values)
Taskdict (must carry a type key)
Task resultdict
State-changing@call
Read-only@query
Errorsraise

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):

CapabilityMeaning
inferenceAgent can perform ML inference
trainingAgent can perform model training
data_accessAgent can access external data feeds
cross_contractAgent 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. Sets agent_id to ctx.contract_address, records the deployer as owner, stores agent_uri, filters capabilities to the four valid values, activates the agent, and emits AgentRegistered.

Calls

  • register(ctx, agent_uri: str, capabilities: list) -> str Re-registers or updates the agent (owner only). Replaces the URI and capability set, re-activates, emits AgentUpdated, and returns the agent_id.

  • bind_capability(ctx, capability: str) -> bool Adds a single capability (owner only). Raises ValueError for an unknown capability; emits CapabilityBound when a new capability is added. Returns True.

  • execute(ctx, task: dict) -> dict Executes a task. The agent MUST be active, and task["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) -> bool Deactivates the agent (owner only). Emits AgentRevoked. Returns True.

Queries

  • get_agent() -> dict Returns {agent_id, owner, uri, capabilities, active, task_count}.

  • get_capabilities() -> list Returns 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: str
  • owner: str
  • uri: str
  • capabilities: list

AgentUpdated

MUST fire when the agent is re-registered via register.

  • agent_id: str
  • uri: str
  • capabilities: list

CapabilityBound

MUST fire when a new capability is bound.

  • agent_id: str
  • capability: str

TaskExecuted

MUST fire when a task is executed.

  • agent_id: str
  • task_id: str
  • task_type: str
  • sender: 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 execute call 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, and AgentValidationRegistry. Agents can also call other contracts when they hold the cross_contract capability.
  • Caller-side handle: The panda.Agent SDK type wraps cross-contract calls into an agent that exposes a complete(prompt) -> str method (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.