What is an Agent?
An Agent in LoopOS AI is a specialized AI entity that can:- Process natural language input
- Call tools to interact with external systems
- Make decisions and generate structured outputs
- Hand off to other agents when needed
Agent Architecture
Each agent has:Instructions
System instructions that define agent behavior and goals.
Tools
Functions the agent can call to interact with external systems.
Output Type
Pydantic model defining the structured output format.
Handoffs
Other agents this agent can hand off to with conditions.
Agent Types
Single-Purpose Agents
Agents that perform one specific task:- Decision Agent: Chooses from options based on context
- Brands Agent: Finds common brands for categories
- Value Estimation Agent: Estimates item values
- ID Validator Agent: Validates ID documents
Workflow Agents
Agents that are part of multi-step workflows:- Product Identification Agent: Identifies products from catalog
- Product Options Agent: Collects product options/variants
- Create Item Agent: Creates items in LoopOS Core
- Protocol Agent: Asks and validates protocol questions
Validation Agents
Specialized agents for validation tasks:- Title/Description Validation Agent: Validates marketplace listings
- Brand Validation Agent: Validates brand names
- Product Validation Agent: Validates product names
Agent Handoffs
Agents can hand off to other agents when specific conditions are met:Handoff Conditions
Handoffs occur when:- Agent calls a specific tool (e.g.,
create_item) - Agent generates specific output (e.g.,
product_idin context) - User provides specific input (e.g., confirms product selection)
Handoff Data
Data passed between agents:Tools
Tools are functions agents can call to interact with external systems:Catalog Tools
get_catalog: Query products, brands, categoriesItem Tools
create_item: Create items in LoopOS CoreProtocol Tools
get_product_protocol: Get protocol questions
validate_protocol_answer: Validate answersWeb Search
web_search: Search web for market dataTool Execution
Tools are executed by agents during conversation:- Agent decides to call a tool based on instructions
- Tool function executes (may call external APIs)
- Tool result returned to agent
- Agent processes result and continues conversation
Agent Context
Agents maintain context throughout execution:- Initialized from request
- Updated by tools
- Passed to handoffs
- Used in final output
Agent Instructions
Instructions define agent behavior:- Role definition: What the agent is
- Goal: What the agent should accomplish
- Tool policies: When and how to use tools
- Handoff conditions: When to hand off to other agents
- Communication style: How to interact with users
Output Types
Agents return structured outputs defined by Pydantic models:- Text responses
- HTML content
- Structured data
- Tool call results
Multi-Agent Workflows
Complex workflows use multiple agents:Submission Workflow
1
Product Identification
User describes product → Agent searches catalog → Presents options → User confirms
2
Options Selection
Agent presents product options → User selects → Options validated
3
Item Creation
Agent creates item in LoopOS Core → Receives item_token
4
Protocol Questions
Agent asks protocol questions → Validates answers → Completes submission
Best Practices
Related Documentation
- Architecture - System architecture
- Services - Service patterns
- Context - Context management
- Submission Service - Example multi-agent workflow