Agents#
This page presents all APIs and classes related to Agents in PyAgentSpec.
Agent class#
- class pyagentspec.agent.Agent(*, id=<factory>, name, description=None, metadata=<factory>, min_agentspec_version=AgentSpecVersionEnum.v25_4_1, max_agentspec_version=AgentSpecVersionEnum.v25_4_1, inputs=None, outputs=None, llm_config, system_prompt, tools=<factory>)#
Bases:
AgenticComponent
An agent is a component that can do several rounds of conversation to solve a task.
It can be executed by itself, or be executed in a flow using an AgentNode.
Examples
>>> from pyagentspec.agent import Agent >>> from pyagentspec.property import Property >>> expertise_property=Property( ... json_schema={"title": "domain_of_expertise", "type": "string"} ... ) >>> system_prompt = '''You are an expert in {{domain_of_expertise}}. ... Please help the users with their requests.''' >>> agent = Agent( ... name="Adaptive expert agent", ... system_prompt=system_prompt, ... llm_config=llm_config, ... inputs=[expertise_property], ... )
- Parameters:
id (str) – A unique identifier for this Component
name (str) – Name of this Component
description (str | None) – Optional description of this Component
metadata (Dict[str, Any] | None) – Optional, additional metadata related to this Component
min_agentspec_version (AgentSpecVersionEnum) –
max_agentspec_version (AgentSpecVersionEnum) –
inputs (List[Property] | None) – List of inputs accepted by this component
outputs (List[Property] | None) – List of outputs exposed by this component
llm_config (LlmConfig) – Configuration of the LLM to use for this Agent
system_prompt (str) – Initial system prompt used for the initialization of the agent’s context
tools (List[Tool]) – List of tools that the agent can use to fulfil user requests