Skip to content

API Reference

Classes:

Name Description
LlamaIndexAgent

Adapter class to wrap a LlamaIndex agent for use with FastAPIAgents.

LlamaIndexAgent

Adapter class to wrap a LlamaIndex agent for use with FastAPIAgents.

Parameters:

Name Type Description Default
agent Callable[[AgentRunner], Any]

The LlamaIndex agent.

required

Example:

from fastapi_agents.llama_index import LlamaIndexAgent
from llama_index.agent.openai import OpenAIAgent
from llama_index.llms.openai import OpenAI

agent = OpenAIAgent.from_llm(tools=None, llm=OpenAI("gpt-4o-mini"))
agents.register("llamaindex", LlamaIndexAgent(agent))

Raises:

Type Description
ValueError

If the agent is not a LlamaIndex agent.

Returns:

Name Type Description
LlamaIndexAgent

A LlamaIndex agent.