agentle.agents.agent_team

Agent Team Module for the Agentle Framework

This module provides functionality for creating dynamic teams of AI agents managed by an orchestrator. AgentTeam implements a flexible approach to multi-agent systems where agents are selected at runtime based on the specific requirements of each task and subtask.

Unlike the AgentPipeline which follows a fixed sequence of agents, AgentTeam uses an orchestrator agent to dynamically analyze tasks and select the most appropriate agent to handle each step. This provides greater flexibility and adaptability, particularly for complex workflows where:

  1. The optimal sequence of agents depends on the specific task

  2. Different agents may be needed depending on the content of previous responses

  3. The same agent may need to be invoked multiple times for different aspects of a task

  4. The task completion criteria can only be determined at runtime

Example: ```python from agentle.agents.agent import Agent from agentle.agents.agent_team import AgentTeam from agentle.agents.agent_config import AgentConfig from agentle.generations.providers.google.google_genai_generation_provider import GoogleGenaiGenerationProvider

# Create provider for all agents provider = GoogleGenaiGenerationProvider()

# Create specialized agents research_agent = Agent(

name=”Research Agent”, description=”Specialized in finding information and data on various topics”, generation_provider=provider, model=”gemini-2.0-flash”, instructions=”You are a research agent focused on gathering accurate information.”,

)

coding_agent = Agent(

name=”Coding Agent”, description=”Specialized in writing and debugging code in various languages”, generation_provider=provider, model=”gemini-2.0-flash”, instructions=”You are a coding expert that writes clean, efficient code.”,

)

writing_agent = Agent(

name=”Writing Agent”, description=”Specialized in creating clear and engaging written content”, generation_provider=provider, model=”gemini-2.0-flash”, instructions=”You are a writing expert that creates compelling content.”,

)

# Create a team with these agents and an orchestrator team = AgentTeam(

agents=[research_agent, coding_agent, writing_agent], orchestrator_provider=provider, orchestrator_model=”gemini-2.0-flash”, team_config=AgentConfig(maxIterations=10)

)

# Run the team with a task result = team.run(“Research the latest advancements in quantum computing and summarize them.”) print(result.generation.text) ```

Functions

Field()

!!! abstract "Usage Documentation"

cast(typ, val)

Cast a value to a type.

model_validator()

!!! abstract "Usage Documentation"

run_sync(func[, timeout])

Runs a callable synchronously.

Classes

Agent(*[, uid, name, description, url, ...])

The main class of the Agentle framework that represents an intelligent agent.

AgentConfig(*[, generationConfig, ...])

Configuration class for Agentle agents.

AgentRunOutput(*[, generation, ...])

Represents the complete result of an agent execution.

AgentTeam(*, agents[, ...])

A dynamic team of AI agents managed by an orchestrator agent.

Any(*args, **kwargs)

Special type indicating an unconstrained type.

BaseModel()

Alias for pydantic.BaseModel.

GenerationProvider(*[, tracing_client])

Abstract base class for AI generation service providers.

GoogleGenaiGenerationProvider(*[, ...])

MutableSequence()

All the operations on a read-write sequence.

Sequence()

All the operations on a read-only sequence.

UUID([hex, bytes, bytes_le, fields, int, ...])

Instances of the UUID class represent UUIDs as specified in RFC 4122.