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

# Agents

> Learn about agents in Compozy and how they extend workflow capabilities.

export const BrowseRegistry = ({title, description, icon, href}) => <div className="not-prose mb-8">
    <a href={href} className="group relative block overflow-hidden rounded-xl border border-gray-950/10 dark:border-white/10 bg-gradient-to-br from-white to-gray-50 p-1 transition-all hover:border-primary hover:shadow-lg dark:from-background-dark dark:to-background-dark/80">
      <div className="absolute inset-0 bg-gradient-to-r from-primary/0 via-primary/0 to-primary/0 opacity-0 transition-opacity group-hover:opacity-10" />
      <div className="relative flex items-start gap-6 p-5">
        <div className="flex px-8 h-14 w-14 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary shadow-sm dark:bg-primary/20 dark:shadow-none">
          <Icon icon={icon} iconType="solid" size={24} />
        </div>

        <div className="flex-1">
          <div className="flex items-center justify-between">
            <h3 className="m-0 text-xl font-semibold text-gray-900 group-hover:text-primary dark:text-white">
              {title}
            </h3>
            <Icon icon="arrow-right" iconType="solid" size={20} className="text-gray-400 transition-transform group-hover:translate-x-1 group-hover:text-primary" />
          </div>
          <p className="m-0 mt-2 text-gray-500 dark:text-gray-400">
            {description}
          </p>
          <div className="mt-4 flex items-center gap-2 text-sm font-medium text-primary">
            Browse Registry
            <Icon icon="chevron-right" iconType="solid" size={12} className="transition-transform group-hover:translate-x-0.5" />
          </div>
        </div>
      </div>
    </a>
  </div>;

<BrowseRegistry title="Browse Registry Agents" description="Discover pre-built agents for task automation, data analysis, and workflow orchestration in the Compozy registry" icon="robot" href="/registry/agents" />

## What are Agents?

Agents in Compozy are autonomous AI-powered components that can understand instructions, use tools, and make decisions. They serve as the intelligent workers in your workflows, capable of processing information, interacting with various services, and producing structured outputs. Agents can be used within tasks to create sophisticated automation workflows.

<CodeGroup>
  ```yaml Basic Usage theme={"dark"}
  agents:
    - id: content_moderator
      use: compozy/agents:content-moderator
      config:
        provider: openrouter
        model: openai/gpt-4-turbo
        api_key: "{{ env.OPENROUTER_KEY }}"
      with:
        language: en
        threshold: 0.7
  ```

  ```yaml Custom Agent theme={"dark"}
  agents:
    - id: support_assistant
      use: agent(custom)
      config:
        provider: openrouter
        model: anthropic/claude-3-sonnet
        api_key: "{{ env.OPENROUTER_KEY }}"
        temperature: 0.4
        max_tokens: 1000
      tools:
        - id: knowledge_base
          config:
            collection: support_docs
      with:
        query: "{{ trigger.query }}"
        context: "{{ trigger.context }}"
      schema:
        input:
          type: object
          properties:
            query:
              type: string
            context:
              type: object
  ```
</CodeGroup>

## Core Features

<CardGroup cols={2}>
  <Card title="Model Flexibility" icon="brain">
    Support for multiple AI providers and models, allowing you to choose the best fit for each task
  </Card>

  <Card title="Task Integration" icon="diagram-project">
    Seamless integration with Compozy tasks for complex workflows and parallel processing
  </Card>

  <Card title="Tool Integration" icon="wrench">
    Seamless integration with tools for extended capabilities like API calls, data processing, and external services
  </Card>

  <Card title="Structured Output" icon="code">
    Define exact output schemas for predictable and validated responses
  </Card>

  <Card title="Context Management" icon="database">
    Built-in memory and context management through MCP integration
  </Card>

  <Card title="Framework Agnostic" icon="puzzle-piece">
    Use any agent framework like LangChain, AutoGPT, or create custom implementations
  </Card>
</CardGroup>

## How Agents Work

<Steps>
  <Step title="Task Definition" icon="list-check">
    Agents are defined within tasks with specific configurations and tools
  </Step>

  <Step title="Configuration" icon="gear">
    Configure the agent with an AI provider, model, and optional tools
  </Step>

  <Step title="Tool Integration" icon="wrench">
    Connect agents with tools to extend their capabilities beyond language processing
  </Step>

  <Step title="Execution" icon="play">
    Agents execute within task contexts, processing inputs and producing structured outputs
  </Step>

  <Step title="Memory Management" icon="database">
    Maintain context across interactions using built-in memory systems
  </Step>
</Steps>

## Memory and Context

Agents in Compozy maintain context through:

<CardGroup cols={2}>
  <Card title="Task Context" icon="diagram-project">
    Access task state, inputs, and outputs within the workflow
  </Card>

  <Card title="Short-term Memory" icon="clock">
    Maintains conversation context within a single execution
  </Card>

  <Card title="Long-term Memory" icon="database">
    Persists information across multiple executions using MCP
  </Card>

  <Card title="Tool State" icon="gear">
    Tracks tool interactions and their outcomes
  </Card>
</CardGroup>

## Key Points

<Steps>
  <Step title="AI-Powered Automation" icon="robot">
    Leverage advanced language models to process instructions and make intelligent decisions
  </Step>

  <Step title="Tool Integration" icon="wrench">
    Extend capabilities by connecting agents with tools for API calls, data processing, and external services
  </Step>

  <Step title="Context Management" icon="database">
    Built-in memory systems maintain context across conversations and workflow executions
  </Step>

  <Step title="Structured Interactions" icon="code">
    Define precise input/output schemas for predictable and validated agent responses
  </Step>
</Steps>

## Next Steps

* Learn about [Agent Configuration](/core/agents/usage)
* Explore [Task Integration](/core/tasks/overview)
* Understand [MCP Integration](/core/mcp/overview)
* Review [Memory Management](/core/memory/overview)
