---
title: "Agent Collaboration with Team Workflow: Pixelagent's Agent-as-Tool Approach"
date: "2025-04-24"
author: "Pixeltable Team"
tags:
  - Agents
  - AI Agents
  - Agent Engineering
  - Multi-Agent Systems
  - Team Workflow
  - LLM
  - Pixeltable
  - Open Source
  - Pixelagent
  - Agent-as-Tool
description: "Learn how Pixelagent simplifies building multi-agent systems by treating specialized AI agents as callable tools, enabling complex collaborative workflows."
url: "https://pixeltable.com/blog/pixelagent-team-workflows"
---

# Agent Collaboration with Team Workflow: Pixelagent's Agent-as-Tool Approach

## Beyond Single Agents: The Need for Collaboration

 
While single AI agents can accomplish impressive tasks, many real-world problems require diverse skills and collaboration, much like human teams. This has led to the rise of multi-agent systems, where specialized agents work together, coordinating their efforts to achieve a common goal.

 
However, orchestrating these agent teams – managing communication, state, and task delegation – introduces significant complexity. How can we build these collaborative workflows without getting bogged down in intricate plumbing?

 
## Pixelagent's Agent-as-Tool Approach

 
In our [Pixelagent launch post](/blog/pixelagent-launch), we discussed how Pixeltable provides the essential data infrastructure for building robust agents. This foundation also unlocks a remarkably elegant way to build multi-agent systems: **treating specialized agents as callable tools for other agents.**

 
Instead of complex message buses or orchestration protocols, Pixelagent allows you to wrap an entire agent's functionality (like a financial analyst agent) into a Pixeltable [User-Defined Function (UDF)](/blog/python-udfs-pixeltable). This UDF can then be passed as a standard tool to another agent (like a portfolio manager agent). When the manager agent decides to use the "analyst tool," Pixelagent and Pixeltable seamlessly handle the execution of the specialist agent and return the result, abstracting away the inter-agent communication logic.

 
## Example: Portfolio Manager & Financial Analyst Team

 
Let's illustrate this with a common scenario: a Portfolio Manager agent needs detailed stock analysis, which is best performed by a specialized Financial Analyst agent.

 
### Setup

 
First, ensure you have the necessary packages installed:

 
```bash

# Install Pixelagent and dependencies
pip install pixelagent yfinance
# Install provider-specific libraries (OpenAI for Manager, Anthropic for Analyst)
pip install openai anthropic
 
```

 
### 1. Define the Specialist Agent (Financial Analyst with Anthropic)

 
First, we create the Financial Analyst agent using Anthropic's Claude model. It has access to a basic `stock_price` tool.

 
```python

import pixeltable as pxt
import yfinance as yf
# Using Anthropic for the Financial Analyst
from pixelagent.anthropic import Agent

# Define a basic tool for the analyst
@pxt.udf
def stock_price(ticker: str) -> dict:
 ""Retrieve the current stock price for a given ticker symbol.""
 stock = yf.Ticker(ticker)
 return stock.info

# Create the Financial Analyst agent (using Anthropic)
financial_analyst = Agent(
 agent_name="financial_analyst_claude", # Give it a distinct name
 system_prompt="You are a meticulous CFA providing detailed stock analysis using Claude.",
 model="claude-3-7-sonnet-latest", # Specify the Anthropic model
 tools=pxt.tools(stock_price),
 reset=True, # Reset state for each call when used as a tool
)
 
```

 
### 2. Wrap the Specialist Agent as a Tool (UDF)

 
This is the key step. We wrap the `financial_analyst` agent instance into a Pixeltable [UDF](/blog/python-udfs-pixeltable). We specify that the UDF should return the final answer generated by the analyst agent.

 
```python

# Wrap the financial_analyst agent instance into a callable UDF
financial_analyst_udf = pxt.udf(
 financial_analyst, # The agent instance to wrap
 return_value=financial_analyst.answer # Specify which agent output to return
)
 
```

 
Now, `financial_analyst_udf` is a standard Pixeltable function that encapsulates the entire reasoning and tool-use capability of the Financial Analyst agent.

 
### 3. Define the Manager Agent (Portfolio Manager)

 
Next, we create the Portfolio Manager agent. We give it the `financial_analyst_udf` as one of its available tools.

 
```python

# Assuming the Manager uses OpenAI (can be changed)
from pixelagent.openai import Agent

# Create the Portfolio Manager agent
portfolio_manager = Agent(
 agent_name="portfolio_manager",
 system_prompt="You are a Portfolio Manager coordinating financial reports.",
 model="gpt-4.1-2025-04-14", # Specify the OpenAI model
 # Pass the analyst UDF as a tool!
 tools=pxt.tools(financial_analyst_udf),
 reset=True,
)
 
```

 
### 4. Orchestrate the Workflow

 
The Portfolio Manager can now interact and delegate tasks to the Financial Analyst simply by calling it like any other tool.

 
```python

# Start interaction with the Portfolio Manager
print("--- Manager Initial Request ---")
print(portfolio_manager.chat("Create the structure of a financial report for NVIDIA"))

# Manager decides to delegate analysis via tool call
print("
--- Manager Delegates to Analyst Tool ---")
# The 'tool_call' triggers the financial_analyst_udf
analysis_result = portfolio_manager.tool_call(
 "Ask your financial analyst for a comprehensive analysis on NVIDIA based on the latest stock price."
)
print(f"Analysis Received by Manager: {analysis_result}") # Manager gets the analyst's final answer

# Manager uses the analysis to finalize the report
print("
--- Manager Finalizes Report ---")
print(portfolio_manager.chat("Using the analysis provided, finalize your report."))
 
```

 
In this flow, the Portfolio Manager agent initiates the process. When it needs detailed analysis, it makes a `tool_call` targeting the `financial_analyst_udf`. Pixelagent handles executing that UDF (which runs the Financial Analyst agent, potentially involving its own tool calls like `stock_price`), captures the analyst's final response (`financial_analyst.answer`), and returns it to the manager agent as the tool call result. The manager then proceeds with the received information.

 
## Why Use the Agent-as-Tool Pattern?

 

 - **Modularity:** Build highly specialized agents that excel at specific tasks.

 - **Reusability:** The same specialist agent (like the Financial Analyst) can be used as a tool by multiple different manager agents or workflows.

 - **Simplified Orchestration:** The manager agent only needs to know *what* capability it needs (e.g., "financial analysis") and which tool provides it. It doesn't need to manage the internal steps of the specialist agent.

 - **Clear Separation of Concerns:** Each agent maintains its own logic, prompts, and potentially tools.

 - **Leverages Pixeltable:** Implicitly benefits from Pixeltable's state management, persistence, and potential for observability across agent interactions.

 

 
## Building Smarter Teams, Simply

 
Pixelagent's agent-as-tool pattern, enabled by Pixeltable's data infrastructure, provides a powerful yet intuitive way to construct complex multi-agent systems. By abstracting specialist agents into callable functions, you can build sophisticated collaborative workflows with significantly less orchestration overhead.

 
This approach moves beyond simple pipelines, enabling true delegation and specialized reasoning within your AI agent teams. Explore the possibilities and build your own collaborative agents!

 

 - **[Read the Pixelagent Launch Announcement](/blog/pixelagent-launch)**

 - **[Pixelagent GitHub Repository](https://github.com/pixeltable/pixelagent)**

 - **[Pixelagent Documentation](https://docs.pixeltable.com/libraries/pixelagent)**

 - **[Join our Discord Community](https://discord.gg/pixeltable)**