> ## Documentation Index
> Fetch the complete documentation index at: https://docs.symbolica.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Agentic Functions vs Agents

> Understanding when to use each pattern

## The Core Difference

* [**Agentic Functions**](#agentic-functions) are **stateless** -- each call is independent
* [**Agents**](#agents) are **stateful** -- they maintain context across calls

## Choosing Between Them

* **Single jump vs journey**: Use an agentic function when the job is “Given X, return Y” in one call; use an agent when you naturally say “First do A, then based on that do B, then refine with C…”.
* **Isolation vs shared context**: Agentic calls are independent and great for extraction, transformation, and batch jobs; agents keep conversation and REPL history, so later steps can build on earlier reasoning.
* **Pipeline step vs orchestrator**: Agentic functions plug in as pure steps inside existing pipelines; agents own longer-lived workflows, conversations, and tool orchestration where they steer the process.
* **Cost profile**: Agentic functions scale to many cheap calls with predictable behavior; agents are heavier but better suited for deeper, higher-value tasks where the extra context and adaptability pay off.

<AccordionGroup>
  <Accordion title={<span><strong>Decision matrix:</strong> Agentic Functions vs. Agents</span>} icon="table">
    | Situation / Requirement                                              | Agentic Functions                        | Agents                                 | Why                                                                        |
    | -------------------------------------------------------------------- | ---------------------------------------- | -------------------------------------- | -------------------------------------------------------------------------- |
    | You can phrase the job as “Given X, produce Y” in one shot           | ✅ **Best fit**                           | ⚠️ Overkill                            | Agentic functions are optimized for single, stateless transforms.          |
    | Each input item is independent (batches, lists, records)             | ✅ **Best fit**                           | ❌ Not appropriate                      | No cross-item memory needed; agent state adds no benefit.                  |
    | You need to keep and reuse context across multiple steps             | ❌ Loses context each call                | ✅ **Best fit**                         | Agents maintain conversation and REPL history.                             |
    | Later steps depend tightly on earlier agent outputs                  | ⚠️ Must manually pass everything back in | ✅ **Best fit**                         | With agents, the prior reasoning is “already in the room.”                 |
    | The workflow is conversational or exploratory                        | ❌ Awkward (you’d simulate a chat)        | ✅ **Best fit**                         | Agents are built for back-and-forth refinement.                            |
    | You want strict, predictable “pure function” behavior                | ✅ **Best fit**                           | ⚠️ Possible but harder to reason about | Stateless calls are easier to test, debug, and cache.                      |
    | You want agents to orchestrate tools over time (plan → act → adjust) | ⚠️ Only for simple tool calls            | ✅ **Best fit**                         | Agents shine in multi-step orchestration loops.                            |
    | You need to run at scale (thousands of similar calls)                | ✅ **Best fit**                           | ❌ Expensive & complex                  | Stateless calls parallelize and scale horizontally.                        |
    | You have strict latency or cost budgets per operation                | ✅ Typically cheaper, more predictable    | ⚠️ Higher overhead                     | Agent state and multiple turns increase cost/latency.                      |
    | You’re integrating into an existing pipeline as a “smart function”   | ✅ Natural drop-in                        | ⚠️ Integration overhead                | Agentic functions look like any other function; agents introduce sessions. |
    | You need to inspect / audit behavior per call                        | ✅ Narrow, local reasoning                | ⚠️ State makes it harder to replay     | Stateless calls are easier to log and replay in isolation.                 |
  </Accordion>
</AccordionGroup>

## Agentic Functions

Stateless AI operations. Each call has a fresh [REPL](/concepts/how-it-works), and is independent with no memory of previous calls. Use these for:

* Extraction, transformation, loading data into structures
* Batch processing independent items
* Single-shot generation or classification
* Pure functions with AI logic

<CodeGroup>
  ```python Python theme={null}
  @agentic()
  async def extract_order_from_email(email: str) -> Order:
      """Extract the customer order details"""
      ...

  @agentic(get_bug_reports)
  async def group_by_severity() -> dict[Literal["severe", "medium", "low"], list[BugReport]]:
      """Obtain the bug reports, read them, and group by severity"""
      ...
  ```

  ```typescript TypeScript theme={null}
  async function extractOrderFromEmail(email: string): Promise<Order> {
    return agentic("Extract the customer order details", { email });
  }

  async function groupBySeverity(): Promise<Record<"severe" | "medium" | "low", BugReport[]>> {
    return agentic("Obtain the bug reports, read them, and group by severity", { getBugReports });
  }
  ```
</CodeGroup>

## Agents

Stateful AI workflows. Maintains conversation and [REPL history](/concepts/how-it-works) and builds on previous interactions. Use these for:

* Multi-step workflows where the steps have serial dependencies
* Conversational interfaces
* Iterative refinement
* Complex orchestration

<CodeGroup>
  ```python Python theme={null}
  agent = await spawn(premise="You are a data analyst")

  analysis = await agent.call(str, "Analyze these sales figures", sales_data=data)
  recommendation = await agent.call(str, "Based on those trends, what should we focus on?")
  revised = await agent.call(str, "Revise that assuming a 20% budget cut")
  ```

  ```typescript TypeScript theme={null}
  await using agent = await spawn({ premise: "You are a data analyst" });

  const analysis = await agent.call<string>("Analyze these sales figures", { data });
  const recommendation = await agent.call<string>("Based on those trends, what should we focus on?");
  const revised = await agent.call<string>("Revise that assuming a 20% budget cut");
  ```
</CodeGroup>

## Next Steps

<CardGroup cols={2}>
  <Card title="Agentic Functions" icon="wand-magic-sparkles" href="/concepts/agentic">
    Documentation
  </Card>

  <Card title="Agents" icon="user-tie" href="/concepts/agent">
    Documentation
  </Card>

  <Card title="Advanced" icon="hat-wizard" href="/concepts/unmcp">
    UnMCP
  </Card>

  <Card title="Examples" icon="code" href="/guides/examples">
    Working examples
  </Card>
</CardGroup>
