Skip to main content
This is detailed usage documentation. New to the Agentica SDK? Start with the Quickstart or learn when to use agentic functions vs agents.

Using agentic

Agentic functions are stateless, decorator‑based functions implemented by the model; each call is independent. The de facto way to implement an agentic function is via the @agentic decorator.

When to use agentic functions

Agentic functions work best for completing simple, well-defined tasks that don’t benefit from maintaining context across multiple operations. For longer-running, multi-task, contextual problem solving, see Agents.

The basics

The Agentica SDK’s agentic decorator enables you to turn regular Python or TypeScript functions into agent-backed functions. Define a function with a descriptive prompt or docstring and simply call it like any other function.
Function bodies in Python should contain a descriptive doc-string, but otherwise be empty (body contains ...). See here for best practices on writing effective doc-strings.
See the full API in the references: Python | TypeScript.

Use your tools and types

Expose the full programmatic power of an SDK or API. No MCP server is required. Simply pass it into your agentic functions scope. You can also expose existing remote or local MCP tools by passing an MCP configuration path. See here for more information.
Prerequisites:
  • Python: run pip install art or uv add art
  • TypeScript: run npm install figlet (or use pnpm, bun)
  • Objects passed to scope or as arguments are presented without private methods or field names (fields with a leading _).
  • Async functions in scope are exposed to the REPL as synchronous functions returning Future[T]. The REPL includes a top-level event loop, so agents can await these futures directly and use standard patterns like asyncio.gather().

Streaming

Stream responses as they are being generated.

Using MCP

Advanced

You can expose custom exceptions in scope so they can be raised from within execution (see here, including information on logging, retries, rate-limiting and prefix caching). For more examples, see Examples.