Skip to main content

Crate weirdnet_agent

Crate weirdnet_agent 

Source
Expand description

Weirdnet agent runtime.

A model-agnostic agent loop shared by WeirdBrains apps. Apps supply a ModelBackend, tool sources and an Approver; this crate runs the turn loop, enforces the approval Policy and research Budget, and records a Trace whose Citations are checked against the steps that fetched them.

  • session: AgentSession, the turn loop with streaming AgentEvents.
  • cancel: CancelToken, checked between model and tool steps.
  • tool: Tool, ToolSource (local now, MCP and remote nodes later) and ToolRegistry.
  • policy: tiers, per-companion per-site grants, task approvals and standing allows.
  • budget: searches, pages, concurrency and time limits.
  • trace: steps, citations and the cited-step check.
  • model: the model backend trait and chat messages.
  • remote: remote inference (offload a model turn to another node, with fallback) and remote tasks (Node companions) over an app-supplied channel.

Nothing here is app-specific: browser tools, panels and storage live in the app.

Re-exports§

pub use budget::Budget;
pub use budget::BudgetExceeded;
pub use budget::BudgetTracker;
pub use budget::BudgetUsage;
pub use budget::ToolTimer;
pub use cancel::CancelToken;
pub use identity::AgentId;
pub use identity::AgentIdentity;
pub use identity::AgentKind;
pub use model::DeltaSink;
pub use model::Message;
pub use model::ModelBackend;
pub use model::ModelError;
pub use model::ModelTurn;
pub use model::Role;
pub use model::ToolCall;
pub use policy::ActionRequest;
pub use policy::AllowRule;
pub use policy::ApprovalPrompt;
pub use policy::CompanionScope;
pub use policy::Decision;
pub use policy::DenyReason;
pub use policy::Policy;
pub use policy::PolicyError;
pub use policy::Scope;
pub use policy::SharedPolicy;
pub use policy::SiteLevel;
pub use policy::SkipNotice;
pub use policy::StandingAllow;
pub use policy::TaskApprovals;
pub use policy::Tier;
pub use policy::site_of;
pub use session::AgentConfig;
pub use session::AgentEvent;
pub use session::AgentSession;
pub use session::ApprovalAnswer;
pub use session::Approver;
pub use session::Outcome;
pub use session::PagesPrompt;
pub use session::StopReason;
pub use tool::BudgetCharge;
pub use tool::CallTarget;
pub use tool::LocalTools;
pub use tool::RegistryError;
pub use tool::SourceKind;
pub use tool::Tool;
pub use tool::ToolAnnotations;
pub use tool::ToolContext;
pub use tool::ToolError;
pub use tool::ToolOutput;
pub use tool::ToolRegistry;
pub use tool::ToolSource;
pub use tool::ToolSpec;
pub use trace::ApprovalOutcome;
pub use trace::Citation;
pub use trace::CitationError;
pub use trace::CitationTarget;
pub use trace::SessionMark;
pub use trace::StepId;
pub use trace::StepKind;
pub use trace::Trace;
pub use trace::TraceStep;
pub use trace::retain_valid;
pub use trace::validate_citations;

Modules§

budget
Research budgets: searches, pages, concurrency and time.
cancel
Cooperative cancellation shared between a session, its tools and the UI.
identity
Who an agent (a “companion” in Morph) is.
model
The model backend trait and chat messages. Inference lives elsewhere (weirdnet-model, remote nodes); this crate only drives it.
policy
Approval policy: tiers, per-companion per-site grants, task approvals and standing “Always allow” rules.
remote
Remote inference and remote tasks between one user’s own nodes.
session
The agent loop.
tool
Tools, tool sources and the registry.
trace
Traces, steps and citations.