OxyGent Documentation

repository·main·Indexed 24 days ago

https://github.com/jd-opensource/oxygent

An advanced Python framework for building, deploying, and evolving production-ready multi-agent systems. It features modular 'Oxy' components, a variety of agent classes (including RAG, ReAct, and Distributed agents), and a comprehensive tool system supporting MCP and preset FunctionHub collections. The framework includes OxyBank, a data annotation and retrieval platform supporting Elasticsearch and Vearch for vector search, custom schemas, and automated annotation agents.

Tokens
255.8K
Snippets
515
Records
1.3K
Agent score
82%

What's inside OxyGent

  1. Overview of OxyGent Multi-Agent System

    main

    OxyGent is an open-source Python multi-agent system framework. It unifies Large Language Models (LLMs), Agents, Tools, and Flows into modular components that are assembled via name references. This allows developers to quickly build, run, and iterate on agent-based applications.

    Key features include:

    • Built-in Agent Loops: Automatically handles tool calls, response parsing, and multi-turn reasoning.
    • Python Native: Define agents, tools, and flows using standard Python objects without needing a DSL or configuration files.
    • Diverse Agent Types: Includes ChatAgent, ReActAgent, WorkflowAgent, ParallelAgent, PlanAndSolveAgent, and RAGAgent.
    • MCP Support: Connects to any MCP tool server (Stdio, SSE, Streamable) alongside native Python tools.
    • Multi-Agent Orchestration: Supports hierarchical scheduling, parallel execution, hybrid agents, and distributed systems.
    • A2A Interoperability: Built-in Agent-to-Agent protocol for cross-framework communication (e.g., with LangChain, LangGraph, AgentScope).
    • Web UI & API: Includes a FastAPI server with SSE streaming, a built-in chat interface, and visual debugging tools.
    • Production Features: Supports tracing, conversation history, dynamic prompt management, and SFT training data generation.
  2. Overview of OxyBank

    main
    OxyBank is a lightweight data annotation and retrieval platform designed for building AI training and RAG (Retrieval-Augmented Generation) datasets. It combines Elasticsearch for structured/full-text search with Vearch for vector similarity search, allowing a single "Bank" (data container) to support both traditional keyword filtering and semantic retrieval. It provides a complete workflow including a FastAPI backend, a jQuery-based frontend, JWT authentication, and a pluggable Annotation Agent framework.
  3. Overview of OxyGent framework

    main

    OxyGent is an open-source Python framework designed for building multi-agent systems. It unifies Large Language Models (LLMs), Agents, Tools, and Flows into modular components that can be composed by name.

    Key capabilities include:

    • Built-in Agent Loops: Automatically handles tool invocation, response parsing, and multi-turn reasoning.
    • Python-native: Agents, tools, and flows are defined as Python objects without requiring DSLs or configuration files.
    • Diverse Agent Types: Supports over 10 types including ChatAgent, ReActAgent, WorkflowAgent, ParallelAgent, PlanAndSolveAgent, and RAGAgent.
    • MCP Support: Connects to Model Context Protocol (MCP) tool servers (Stdio, SSE, Streamable).
    • Orchestration: Supports hierarchical delegation, parallel execution, mixture-of-agents, and distributed systems.
    • A2A Interoperability: Built-in Agent-to-Agent protocol support for communicating with other frameworks like LangChain, LangGraph, and AgentScope.
    • Production Ready: Includes a FastAPI server with SSE streaming, a built-in chat interface, visual debugging, tracing, and conversation history management.
  4. Use LocalEs for filesystem-based Elasticsearch simulation

    main

    LocalEs is a filesystem-based implementation of Elasticsearch designed for development and testing. It simulates Elasticsearch functionality by persisting documents as JSON files on the local filesystem.

    To ensure high performance during concurrent writes, it uses an in-memory write-behind cache: mutations are applied to memory instantly and then flushed to disk asynchronously. It supports cross-platform behavior with UTF-8 persistence and atomic file operations.

  5. Use OxyGent Live Prompting

    main

    The Live Prompt module provides tools for managing and optimizing prompts dynamically. It includes:

    • PromptManager for managing prompt assets.
    • PromptOptimizer for refining prompts.
    • VersionSync for managing prompt versions.
    • DynamicAgentManager for managing agents that respond to dynamic prompt changes.
  6. Integrate LLMs with OxyGent

    main

    OxyGent supports multiple LLM integration strategies via the BaseLLM interface:

    • Remote LLMs: Use RemoteLLM to connect to external APIs. This includes HttpLLM for generic HTTP API calls and OpenAILLM for using the OpenAI SDK.
    • Local LLMs: Use LocalLLM to load and run HuggingFace models locally on your hardware.
    • Testing: Use MockLLM to simulate model responses during development and testing.
  7. Comprehensive Multi-Agent Demo Overview

    main

    The Comprehensive Multi-Agent Demo (examples/application/demo.py) showcases how to assemble multiple tool types and agent patterns into a single coordinated system. It demonstrates the integration of Model Context Protocol (MCP) clients, inline tool hubs, and various specialized agent types managed by a master orchestrator.

    Key Architectural Components

    • LLM Backend: Uses HttpLLM configured with low temperature for deterministic behavior.
    • Intent Recognition: A ChatAgent (named intent_agent) utilizes the built-in INTENTION_PROMPT to classify user intent.
    • Tool Integration:
      • FunctionHub: An inline hub using the @fh.tool decorator pattern to define custom tools (e.g., joke_tool).
      • StdioMCPClient: Connects to external MCP servers for specialized capabilities:
        • time_tools: Timezone-aware time queries via mcp-server-time.
        • file_tools: Local filesystem operations via @modelcontextprotocol/server-filesystem.
        • math_tools: Mathematical computations via a custom MCP server.
    • Agent Patterns:
      • ReActAgent (Master Orchestrator): Coordinates sub-agents and applies custom output formatting via func_format_output.
      • ReActAgent (Specialized Workers): Includes a time_agent with custom input preprocessing (func_process_input) and trust_mode=False, and a file_agent for filesystem tasks.
      • WorkflowAgent: A math_agent that executes a custom func_workflow. This agent demonstrates advanced capabilities like accessing short memory at both agent and master levels, sending SSE messages via send_message, performing cross-agent calls with oxy_request.call(), and direct LLM invocation.
    • Runtime: The MAS (Multi-Agent System) container launches the entire system as a web service.
  8. Explore OxyGent Agents

    main

    OxyGent provides a variety of agent classes for different execution patterns. You can use specialized agents for specific tasks or build custom logic by extending the base classes:

    • Base Classes: BaseOxy (universal base), BaseAgent (agent base), and BaseFlow (execution flow base).
    • Conversational Agents: ChatAgent for single-turn interactions, and RAGAgent for retrieval-augmented generation.
    • Reasoning & Action: ReActAgent implements a Reasoning + Acting loop with tool calling. Specialized versions include ShellUseAgent (SSH remote execution) and SkillAgent (dynamic skills).
    • Execution Patterns: ParallelAgent for sub-task concurrency, WorkflowAgent for step-by-step processes, and PlanAndSolveAgent for planning before execution.
    • Distributed Agents: RemoteAgent for connecting to agents in other processes, including SSEOxyGent (SSE-based) and A2AClientAgent (A2A protocol).
  9. Configure OxyGent Execution Flows

    main

    Flows define how tasks are orchestrated and executed. Choose a flow based on your required execution logic:

    • WorkFlow: For sequential step execution.
    • ParallelFlow: For concurrent step execution.
    • PlanAndSolve: For a complex pattern that decomposes a problem, creates a plan, and then solves it.
    • Reflexion: For a self-reflection and retry loop (includes MathReflexion for mathematical reasoning).
  10. A2A Interoperability Patterns

    main

    OxyGent's A2A implementation is designed to work across different frameworks and SDKs. The following interoperability patterns are supported:

    • Cross-Framework: Interoperability with AgentScope, LangChain, and LangGraph.
    • SDK Integration: Compatibility with the generic A2A SDK for calling OxyGent servers.
    • Communication Patterns:
      • Basic single-turn chat.
      • Streaming output consumption.
      • Multi-task follow-up within a shared context.