Team Tools

Equip team members with specialized tools for collaborative workflows.

While a single agent can use tools, cramming too many tools into a small model's prompt can confuse it.

With Teams, you can split your tools across highly specialized agents. When the team leader receives a task, it automatically determines which team member has the right tools for the job and delegates accordingly. 🤝


🛠️ Equipping Team Members

To give a team tools, you simply provide the tools directly to the member Agents. The Team coordinator will analyze the user's request and assign sub-tasks to the agents with the appropriate tools.

Here is an example of a research team where one agent searches the web and the other calculates numbers:

1from kern.agent import Agent
2from kern.team import Team
3from kern.models.openai import OpenAIChat
4from kern.tools.duckduckgo import DuckDuckGo
5from kern.tools.python import PythonTools
6
7local_model = OpenAIChat(id="llama3.2:3b", base_url="http://localhost:11434/v1")
8
9# 1. Equip the researcher with search tools 🔍
10researcher = Agent(
11 name="Researcher",
12 role="Web search specialist",
13 model=local_model,
14 tools=[DuckDuckGo()],
15 instructions="Search the web for the latest information on the topic.",
16)
17
18# 2. Equip the calculator with math tools 🧮
19calculator = Agent(
20 name="Calculator",
21 role="Math specialist",
22 model=local_model,
23 tools=[PythonTools()],
24 instructions="Write and execute python to solve math problems.",
25)
26
27# 3. Form the team! The coordinator handles delegation automatically.
28research_team = Team(
29 name="Research Squad",
30 members=[researcher, calculator],
31)
32
33research_team.print_response(
34 "Search for the current population of Tokyo and Paris, then calculate the difference.",
35 stream=True
36)

⚙️ How Delegation Works

When you run a team, the coordinator agent handles the heavy lifting:

  1. Analysis: The coordinator reads the user's prompt and analyzes the roles and toolsets of its members.
  2. Delegation: It generates a plan and delegates the first sub-task (e.g. "search for population") to the agent equipped with the web search tool.
  3. Execution: The specialized agent executes the tool and reports back.
  4. Handoff: The coordinator passes the results to the next agent (e.g. "calculate the difference") who uses its Python tools to run the math.
  5. Synthesis: The coordinator combines all tool outputs into a final, coherent response for the user.
Tip

By spreading tools across a team, you keep each individual agent's system prompt small and focused. This is critical for maximizing the reasoning capabilities of 1-7B parameter models! 🧠


📚 Next Steps

  • Check out the Toolkits you can give your team members.
  • Learn more about configuring Teams and delegation modes.