Agents are LLM-powered workers with a name, description, and bound LLM client.

Parameters

  • name: Human-friendly label.
  • description: What the agent does.
  • model_provider: LLM vendor (e.g., openai).
  • model_name: Model ID (e.g., gpt-4o, gpt-3.5-turbo).
  • api_secret: Provider API key (distinct from Orkestra api_key).

Attributes

  • config.name: Agent name
  • config.description: Agent description
  • llm: Underlying LLM abstraction

Create an agent

from orkestra import Orkestra, LLMProvider
client = Orkestra()
agent = client.Agent(
  name="Summarizer",
  description="Summarizes text",
  model_provider="openai",
  model_name="gpt-3.5-turbo",
  api_secret="YOUR_OPENAI_API_KEY",
)

Generate: plain text

response = agent.generate("Write a bedtime story about a friendly unicorn.")
print(response)

Generate: structured output (Pydantic)

from pydantic import BaseModel

class CalendarEvent(BaseModel):
  name: str
  date: str
  participants: list[str]

event = agent.generate(
  "Alice and Bob are going to a science fair on Friday.",
  response_model=CalendarEvent,
)
print(event)