Thinagents

Agent

Agents in Thinagents

Agents are the core orchestrators in Thinagents. An Agent manages interactions with language models (LLMs), executes tools, and can even delegate tasks to sub-agents. Agents are highly configurable and can be extended with custom tools, memory, and more.

Usage

Create an Agent with just a few lines of code:

from thinagents import Agent

agent = Agent(
    name="Greeting Agent",
    model="openai/gpt-4o-mini",
)

response = agent.run("Hello, how are you?")
print(response.content)

Add tools to your Agent for more advanced capabilities:

from thinagents import Agent

def get_weather(city: str) -> str:
    return f"The weather in {city} is sunny."

agent = Agent(
    name="Weather Agent",
    model="openai/gpt-4o-mini",
    tools=[get_weather],
)

response = agent.run("What is the weather in Tokyo?")
print(response.content)

Agent Parameters

PropTypeDefault
name
str
-
model
str
-
tools?
list[ThinAgentsTool] | list[Callable]
None
sub_agents?
list[Agent]
None
prompt?
str | PromptConfig
None
instructions?
list[str]
[]
max_steps?
int
15
concurrent_tool_execution?
bool
true
response_format?
BaseModel
None
enable_schema_validation?
bool
true
description?
str
None
tool_timeout?
number
30.0
memory?
BaseMemory
None
kwargs?
dict
-

Note: Most users only need to specify name and model to get started. Add tools, memory, and other options as needed for advanced use cases.