Skip to main content

AgentTemplate

Struct AgentTemplate 

Source
pub struct AgentTemplate {
Show 26 fields pub template_id: String, pub name: String, pub description: String, pub template_type: AgentTemplateType, pub creator: Address, pub creator_did: Option<String>, pub creator_wallet: Option<Address>, pub invocation_count: u64, pub total_revenue: u128, pub version: String, pub status: AgentTemplateStatus, pub created_at: Timestamp, pub updated_at: Timestamp, pub capabilities: Vec<AgentCapability>, pub runtime_requirements: AgentRuntimeRequirements, pub pricing: AgentPricingModel, pub system_prompt: String, pub examples: Vec<AgentExample>, pub tags: Vec<String>, pub download_count: u64, pub rating: u8, pub content_hash: Option<String>, pub docs_url: Option<String>, pub metadata: HashMap<String, String>, pub execution_spec: Option<ExecutionSpec>, pub last_seen_at: Timestamp,
}
Expand description

An agent template published to the Tenzro Network marketplace

Fields§

§template_id: String

Unique template identifier (UUID v4)

§name: String

Template name

§description: String

Detailed description

§template_type: AgentTemplateType

Template type

§creator: Address

Address of the template creator/publisher

§creator_did: Option<String>

Optional DID binding — when present, the template is attributable to a Tenzro identity (did:tenzro:human:... or did:tenzro:machine:...). The DID is bound at registration time and cannot be changed; creators who prefer wallet-only attribution may omit this.

§creator_wallet: Option<Address>

Wallet that receives creator payouts for paid invocations. MUST be Some(_) whenever pricing != Free. For free templates this may be None and the creator simply publishes under creator.

§invocation_count: u64

Cumulative count of successful paid invocations against this template.

§total_revenue: u128

Cumulative gross TNZO revenue (in base units) routed to the creator across all invocations — this is the amount that landed in creator_wallet, i.e. the net-of-commission creator share.

§version: String

Version string (semver, e.g., “1.0.0”)

§status: AgentTemplateStatus

Current status

§created_at: Timestamp

When the template was first published

§updated_at: Timestamp

When the template was last updated

§capabilities: Vec<AgentCapability>

List of capabilities this agent provides

§runtime_requirements: AgentRuntimeRequirements

Runtime requirements for deployment

§pricing: AgentPricingModel

Pricing model

§system_prompt: String

System prompt / agent instructions

§examples: Vec<AgentExample>

Example user messages and expected behavior (for documentation)

§tags: Vec<String>

Tags for discoverability (e.g., [“coding”, “rust”, “debugging”])

§download_count: u64

Number of times this template has been downloaded/deployed

§rating: u8

Average rating (0-100, weighted by stake)

§content_hash: Option<String>

IPFS or content hash of the full template payload

§docs_url: Option<String>

Link to documentation or repository

§metadata: HashMap<String, String>

Additional metadata

§execution_spec: Option<ExecutionSpec>

Optional declarative execution spec consumed by autonomous runtimes (e.g. tenzro-agent-kit). When present, a runtime can instantiate the agent end-to-end (identity, wallet, delegation, tools, skills, execution steps) from the spec alone — no Rust code required.

Templates without this field still deserialize cleanly via #[serde(default)].

§last_seen_at: Timestamp

Unix timestamp (seconds) of the last liveness signal — registration, update, invocation, or explicit tenzro_heartbeatTemplate call. The liveness sweeper flips status to Deprecated once the template stays silent past the configured TTL (templates are kept on-record rather than purged — they have audit value as a marketplace history). Pre-upgrade rows hydrate with the current time (charitable default) so they only appear stale once they actually go silent.

Implementations§

Source§

impl AgentTemplate

Source

pub fn new( name: String, description: String, template_type: AgentTemplateType, creator: Address, system_prompt: String, ) -> Self

Creates a new agent template

Source

pub fn touch(&mut self)

Bumps last_seen_at to the current wall-clock time. Called by the heartbeat RPC and any successful invocation that should keep the template from being marked Deprecated by the liveness sweeper.

Source

pub fn with_creator_did(self, did: impl Into<String>) -> Self

Attach an optional DID binding for creator attribution.

Source

pub fn with_creator_wallet(self, wallet: Address) -> Self

Attach a payout wallet — REQUIRED for any non-Free pricing.

Source

pub fn with_pricing(self, pricing: AgentPricingModel) -> Self

Attach a pricing model.

Source

pub fn is_available(&self) -> bool

Returns true if the template is publicly available

Source

pub fn validate_marketplace_invariants(&self) -> Result<(), String>

Validates publisher-side invariants required before persisting the template in the marketplace: if pricing != Free then creator_wallet must be set (so payouts have a destination).

Returns Err(<reason>) when the invariant is violated. Called from every registerAgentTemplate code path (RPC + MCP).

Source

pub fn record_invocation(&mut self, creator_share: u128)

Records a successful paid invocation against this template. creator_share is the net-of-commission amount that was transferred to creator_wallet.

Trait Implementations§

Source§

impl Clone for AgentTemplate

Source§

fn clone(&self) -> AgentTemplate

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AgentTemplate

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for AgentTemplate

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for AgentTemplate

Source§

impl PartialEq for AgentTemplate

Source§

fn eq(&self, other: &AgentTemplate) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for AgentTemplate

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for AgentTemplate

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.