Appearance
Tools
tools on an Agent block is a list. There are three kinds of entry: a prebuilt tool, a custom @tool file, and another agent. tools: [] is valid for an agent that only talks.
Installation
Prebuilt tools need elsai-agents-tools. A custom file needs only elsai-agents, which ships @tool.
bash
pip install --extra-index-url https://elsai-agents.elsai.ai/root/ elsai-agents-tools==0.3.0Prebuilt tools
Write the module path of a tool from elsai-agents-tools. Import strings only work for these elsai_tools.* modules.
yaml
openai:
type: OpenAIModel
model_id: gpt-4o-mini
helper:
type: Agent
name: Helper
system_prompt: Use the tools for arithmetic and the current time.
model: ${openai}
tools:
- elsai_tools.calculator
- elsai_tools.current_timepython
from elsai.config import yaml_to_agent
agent = yaml_to_agent("agent.yaml", entry="helper")
print(agent("What is 15 * 3, and what time is it?"))Short names such as calculator, class names, and tool dicts are rejected.
Custom tools
Write your own function with @tool in a Python file, then list the file path. The path is relative to the working directory when the agent is built. Every @tool function in the file is registered.
python
# tools/add.py
from elsai import tool
@tool
def add(a: float, b: float) -> float:
"""Add two numbers. Use this instead of guessing."""
return a + byaml
openai:
type: OpenAIModel
model_id: gpt-4o-mini
adder:
type: Agent
name: Adder
system_prompt: Use add for sums.
model: ${openai}
tools:
- ./tools/add.py
- elsai_tools.calculatorpython
from elsai.config import yaml_to_agent
agent = yaml_to_agent("agent.yaml", entry="adder")
print(agent("Use add to sum 12 and 30."))Prebuilt and custom tools can share one list.
HTTP endpoints
An HTTP endpoint is not an entry on tools:. Declare a type: HTTPTool block and list it under http:. See HTTP tools.
Other agents
An entry with type: AgentAsTool lets this agent call another Agent block. See Multi-agent.