Capabilities
A Capability is the fundamental building block of an Agentend application. Instead of REST endpoints, you define Capabilities that receive natural language intents, dispatch work to typed model workers, and stream responses back via the AG-UI protocol.
What is a Capability?
A Capability is an intent-driven unit of agent behavior. When a user sends a natural language message, the kernel classifies it into an intent and dispatches it to the matching Capability. Each Capability declares:
- •Intents — the natural language patterns it handles
- •Workers — the model slots it needs (e.g. extract, verify, summarize)
- •Tools — functions the agent can call during execution
- •Domain context — system prompt context specific to this capability
The @app.capability() decorator
Register a Capability with the Agentend kernel using the decorator. The kernel uses the intents list to route incoming messages, and the workers list to provision the right model slots.
from agentend import Agentend, Capability, tool
app = Agentend()
@app.capability(
name="invoice_processor",
intents=["process invoice", "extract invoice data"],
workers=["extract", "verify", "summarize"],
)
class InvoiceProcessor(Capability):
"""Extract, verify, and summarize invoice data."""
@tool
async def get_vendor_info(self, vendor_id: str) -> dict:
"""Look up vendor details from the database."""
return {"vendor_id": vendor_id, "name": "Acme Corp"}
def get_domain_context(self) -> str:
return "You are an invoice processing specialist."
app.run()Worker declaration
The workers list declares which fleet slots the Capability needs. Agentend has 6 built-in worker slots, each optimized for a different task:
| Slot | Purpose |
|---|---|
| classify | Classify incoming intents and route to capabilities |
| extract | Extract structured data from unstructured input |
| verify | Fact-check and validate outputs |
| summarize | Condense content into summaries |
| generate | Generate responses, content, or code |
| tool_call | Handle tool and function calling |
Each slot maps to a model configured in fleet.yaml. The framework picks the best model for the job based on benchmark data. See the Fleet docs for details.
The @tool decorator
Tools are async methods on a Capability class that the agent can invoke during execution. Decorate any method with @tool to make it available. The method name and docstring are sent to the LLM as the tool definition.
from agentend import Capability, tool
class OrderManager(Capability):
@tool
async def lookup_order(self, order_id: str) -> dict:
"""Retrieve order details by ID."""
# Your database logic here
return {"order_id": order_id, "status": "shipped"}
@tool
async def cancel_order(self, order_id: str, reason: str) -> dict:
"""Cancel an order with a reason."""
return {"order_id": order_id, "cancelled": True}Type hints on tool parameters are used to generate the JSON schema sent to the model. Always include a docstring — it becomes the tool description.
Domain context
Override get_domain_context() to inject capability-specific instructions into the system prompt. This context is combined with core blocks and memory during prompt assembly.
class InvoiceProcessor(Capability):
def get_domain_context(self) -> str:
return """You are an invoice processing specialist.
Always extract: vendor name, invoice number, line items, total amount.
Verify totals against line item sums before responding."""Public API
Agentend exports the following top-level symbols from the agentend package:
| Export | Description |
|---|---|
| Agentend | Main application class (kernel) |
| Capability | Base class for capabilities |
| tool | Decorator to register a method as an agent tool |
| Worker | Worker instance class |
| WorkerConfig | Worker configuration dataclass |
| BenchmarkRegistry | Model benchmark data and recommendations |
| Connector | Base connector for infrastructure integrations |
| ConnectorConfig | Connector configuration |
| ConnectorRegistry | Registry for managing connectors |
| CapabilityBuilder | Chat-to-build capability generator |
CapabilityBuilder
The CapabilityBuilder provides a chat-to-build interface for generating capabilities from natural language descriptions. Describe what your agent should do, and the builder generates the Capability class, tools, and configuration.
from agentend import CapabilityBuilder
builder = CapabilityBuilder()
capability = builder.build(
"An agent that processes refund requests, "
"checks order history, and issues refunds"
)