Agents

Overview

Introduction to AI agents in Compozy - autonomous entities that reason, decide, and execute actions

What are Agents?

Agents in Compozy are autonomous AI-powered entities that can reason, make decisions, and execute actions based on natural language instructions. They serve as the intelligent core of Compozy workflows, orchestrating complex tasks through advanced language model capabilities.

Key Capabilities

Agents combine several powerful features to deliver intelligent automation:

Natural Language Understanding

Process and understand complex instructions in plain English, enabling intuitive task definitions

Dynamic Decision Making

Make contextual decisions based on goals, constraints, and real-time information

Tool Utilization

Access and use external tools dynamically to extend capabilities beyond text generation

Iterative Problem Solving

Self-correct and refine responses over multiple iterations for improved accuracy

Core Features

  • 1
    LLM Integration

    Connect to various AI providers including OpenAI, Anthropic, Google, and local models through a unified interface

  • 2
    Action System

    Define structured actions with input/output schemas for type-safe, predictable interactions

  • 3
    Tool Access

    Utilize external tools and APIs dynamically, from file operations to complex integrations

  • 4
    MCP Support

    Extend capabilities through Model Context Protocol servers for standardized tool interfaces

  • 5
    Memory Management

    Access shared context across workflow steps and maintain conversational state

  • 6
    Iterative Execution

    Allow agents to refine their responses through multiple reasoning iterations

Basic Agent Configuration

Here's a simple example of an agent configuration:

resource: agent
id: code-assistant
version: 0.1.0

config:
  provider: anthropic
  model: claude-4-opus
  params:
    temperature: 0.7
    max_tokens: 4000

instructions: |
  You are an expert software engineer specializing in code review.
  Focus on clarity, performance, and best practices.
  Always explain your reasoning and provide actionable feedback.

actions:
  - id: review-code
    prompt: "Analyze the provided code for quality and improvements"
    input:
      type: object
      properties:
        code:
          type: string
          description: "The code to review"
        language:
          type: string
          enum: ["python", "go", "javascript"]
      required: ["code", "language"]
    json_mode: true
    output:
      type: object
      properties:
        issues:
          type: array
          items:
            type: object
            properties:
              severity:
                type: string
                enum: ["critical", "high", "medium", "low"]
              description:
                type: string

How Agents Work

1

Initialization

Agent loads configuration including instructions, model settings, and available tools

2

Context Building

Gathers relevant context from workflow inputs, memory, and previous task outputs

3

Action Execution

Processes the specified action with the given inputs and constraints

4

Tool Usage

Dynamically decides when and how to use available tools to complete the task

5

Iteration

Refines response through multiple iterations if needed (up to max_iterations)

6

Output Generation

Produces structured output according to the action's schema

Agent Architecture

Loading diagram...

Use Cases

Agents excel in various scenarios:

Best Practices

  • 1
    Be clear and specific

    Define the agent's role explicitly to ensure consistent behavior

  • 2
    Define boundaries

    Set clear constraints on what the agent should and shouldn't do

  • 3
    Include domain knowledge

    Provide relevant context and expertise for better performance

  • 4
    Use markdown structure

    Format instructions with markdown for better readability

Next Steps