Workflow:Neuml Txtai Agent Execution
| Knowledge Sources | |
|---|---|
| Domains | AI_Agents, LLMs, Tool_Use |
| Last Updated | 2026-02-10 00:00 GMT |
Overview
End-to-end process for configuring and running an AI agent that autonomously selects and uses tools to answer multi-faceted user requests.
Description
This workflow covers the creation of an AI agent powered by txtai. Agents use an LLM to iteratively reason about a task, select appropriate tools, execute them, and synthesize a final answer. The agent system is built on top of the smolagents framework and supports embeddings search tools, custom Python functions, built-in web tools, and skill-based tools loaded from markdown files. Agents are best suited for complex, multi-step tasks that require combining multiple data sources or capabilities.
Usage
Execute this workflow when you need to handle complex, open-ended requests that require multiple tools or data sources. Agents are appropriate when the task cannot be solved with a single search query or a fixed pipeline, and instead requires dynamic reasoning about which tools to invoke and in what order. For simpler, predictable tasks, use RAG or Workflow orchestration instead.
Execution Steps
Step 1: Define the Embeddings Data Source
Configure an embeddings database tool that the agent can use for semantic search. This can be a local embeddings index built from your data or a pre-built index loaded from Hugging Face Hub. The tool definition includes a name, description, and either a local path or a remote provider/container pair.
Key considerations:
- Provide a clear, descriptive name and description so the LLM knows when to use this tool
- Multiple embeddings databases can be registered as separate tools
- Pre-built indexes from Hugging Face Hub enable quick prototyping
Step 2: Define Custom Tools
Create additional tools as Python functions with type annotations and docstrings. The agent framework introspects function signatures and documentation to understand each tool's purpose and parameters. Built-in tools like web search and web page loading can also be included.
Tool types:
- Python functions with typed parameters and docstrings
- Built-in tools: "websearch" for web queries, "webview" for page loading
- Skill tools loaded from markdown instruction files
- Embeddings search tools for semantic database queries
Step 3: Configure the LLM
Select and configure the LLM that drives the agent's reasoning. The agent supports local models (Hugging Face Transformers, llama.cpp GGUF, Ollama) and remote APIs (OpenAI, Anthropic, Google via LiteLLM). The LLM must be capable of tool-use and multi-step reasoning.
Key considerations:
- Larger models generally produce better agent behavior
- Set max_steps to limit the number of reasoning iterations
- Configure max sequence length based on the complexity of expected tasks
Step 4: Create the Agent
Instantiate the Agent class with the configured LLM, tool list, and optional parameters. The agent wraps the smolagents process runner and manages the tool registry, memory, and prompt templating.
Configuration options:
- model: LLM model path or configuration dictionary
- tools: list of tool definitions (embeddings, functions, built-in names)
- max_steps: maximum reasoning iterations before stopping
- memory: number of prior interactions to retain for conversational context
- instructions: custom system instructions or path to an instructions file
Step 5: Run Agent Tasks
Invoke the agent with a natural language task. The agent enters a reasoning loop where it analyzes the request, selects appropriate tools, executes them, observes results, and continues until it can formulate a final answer or reaches the step limit.
What happens:
- The prompt is formatted with optional memory context
- The LLM reasons about which tool to use first
- Selected tools are executed and results observed
- The loop continues until the agent produces a final answer
- Output is returned, and optionally stored in conversational memory