Skip to main content

Multi-Modal AI Agent System

Project description

xAgent

Python FastAPI License

A production-ready AI Agent framework focused on easy start and scalable deployment.

  • ✅ Chat via CLI / Python API / HTTP Server
  • ✅ Built-in Web UI and streaming responses
  • ✅ Tool calling, MCP integration, image input
  • ✅ Multi-user + multi-session support
  • ✅ Memory and multi-agent workflows

3-Minute Quick Start

1) Install

pip install myxagent

2) Set environment variable

export OPENAI_API_KEY=your_openai_api_key

3) Start using xAgent

# Interactive CLI
xagent-cli

# Or ask one question
xagent-cli --ask "Hello"

Configure with agent.yaml

If you want to customize the agent prompt, model, tools, or server port, create a YAML config file.

1) Generate a starter config

xagent-cli --init

This creates:

  • config/agent.yaml
  • my_toolkit/ for custom tools

2) Edit config/agent.yaml

agent:
    name: "Assistant"
    system_prompt: |
        You are a helpful AI assistant.
        Answer clearly and accurately.
    model: "gpt-5-mini"

    capabilities:
        tools:
            - "web_search"

    storage_mode: "local"

server:
    host: "0.0.0.0"
    port: 8010

3) Run with your config

# CLI
xagent-cli --config config/agent.yaml --toolkit_path my_toolkit

# HTTP Server + Web UI
xagent-server --config config/agent.yaml --toolkit_path my_toolkit --open

If you do not use custom tools, you can omit --toolkit_path.

For more YAML options, see docs/configuration_reference.md.

Cloud Mode

Use cloud mode when you want shared/distributed conversation history and cloud memory.

1) Install cloud dependencies

pip install "myxagent[cloud]"

2) Set storage_mode: "cloud"

agent:
    storage_mode: "cloud"

3) Set required environment variables

export REDIS_URL=redis://localhost:6379/0
export UPSTASH_VECTOR_REST_URL=https://your-database.upstash.io
export UPSTASH_VECTOR_REST_TOKEN=your_token_here

For config-driven cloud mode, all three are required. If you want local-only execution, keep storage_mode: "local" and install myxagent only.

Most Common Usage

CLI

xagent-cli
xagent-cli --ask "What is the weather in Hangzhou?"

HTTP Server (API + Web UI)

xagent-server
# http://localhost:8010
# Open Web UI automatically
xagent-server --open
# API call example
curl -X POST "http://localhost:8010/chat" \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": "user123",
    "session_id": "session456",
    "user_message": "Hello"
  }'
# Continuous conversation: keep same user_id + session_id
# Turn 1
curl -X POST "http://localhost:8010/chat" \
    -H "Content-Type: application/json" \
    -d '{
        "user_id": "alice",
        "session_id": "daily_chat",
        "user_message": "Remember that my favorite city is Hangzhou."
    }'

# Turn 2 (same session)
curl -X POST "http://localhost:8010/chat" \
    -H "Content-Type: application/json" \
    -d '{
        "user_id": "alice",
        "session_id": "daily_chat",
        "user_message": "What is my favorite city?"
    }'
# Image input via image_source (single image)
curl -X POST "http://localhost:8010/chat" \
    -H "Content-Type: application/json" \
    -d '{
        "user_id": "user123",
        "session_id": "image_session",
        "user_message": "Describe this image.",
        "image_source": "https://example.com/image.jpg"
    }'
# Image input via image_source (multiple images)
curl -X POST "http://localhost:8010/chat" \
    -H "Content-Type: application/json" \
    -d '{
        "user_id": "user123",
        "session_id": "image_session",
        "user_message": "Compare these images.",
        "image_source": [
            "https://example.com/image1.jpg",
            "https://example.com/image2.jpg"
        ]
    }'
# Image URL directly in message text (no image_source needed)
curl -X POST "http://localhost:8010/chat" \
    -H "Content-Type: application/json" \
    -d '{
        "user_id": "user123",
        "session_id": "image_in_message",
        "user_message": "What do you see in this image? https://example.com/cat.jpg"
    }'

Python API

import asyncio
from xagent.core import Agent

async def main():
    agent = Agent(model="gpt-5-mini")
    response = await agent.chat(
        user_message="Hello",
        user_id="user123",
        session_id="session456"
    )
    print(response)

asyncio.run(main())

Continuous Conversation (same session)

Use the same user_id and session_id to keep context across turns:

import asyncio
from xagent.core import Agent

async def main():
    agent = Agent(model="gpt-5-mini")

    user_id = "alice"
    session_id = "daily_chat"

    reply1 = await agent.chat(
        user_message="Remember that my favorite city is Hangzhou.",
        user_id=user_id,
        session_id=session_id,
    )
    print("Turn 1:", reply1)

    reply2 = await agent.chat(
        user_message="What is my favorite city?",
        user_id=user_id,
        session_id=session_id,
    )
    print("Turn 2:", reply2)

asyncio.run(main())

Image Input Support

image_source supports a single value or list, and each item can be an image URL, local file path, or base64 data URI.

import asyncio
from xagent.core import Agent

async def main():
    agent = Agent(model="gpt-5-mini")

    # Single image URL
    reply1 = await agent.chat(
        user_message="What do you see in this image?",
        user_id="user123",
        session_id="image_demo",
        image_source="https://example.com/image.jpg",
    )
    print("Single image:", reply1)

    # Multiple images (URL + local path)
    reply2 = await agent.chat(
        user_message="Compare these two images.",
        user_id="user123",
        session_id="image_demo",
        image_source=[
            "https://example.com/image1.jpg",
            "./local_image.png",
        ],
    )
    print("Multi-image:", reply2)

asyncio.run(main())

Recommended Learning Path

  1. Quickly run it: this README
  2. Project setup + config: xagent-cli --init
  3. Pick your interface: CLI / HTTP / Python API
  4. Then add advanced capabilities: memory, workflows, custom tools

Documentation Center

All technical details are now organized in docs/:

Start Here

Core References

Advanced / Deployment

Examples

Contributing

Contributions are welcome. Please open an issue or pull request on GitHub.

License

This project is licensed under the MIT License. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

myxagent-0.2.35.tar.gz (89.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

myxagent-0.2.35-py3-none-any.whl (108.4 kB view details)

Uploaded Python 3

File details

Details for the file myxagent-0.2.35.tar.gz.

File metadata

  • Download URL: myxagent-0.2.35.tar.gz
  • Upload date:
  • Size: 89.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for myxagent-0.2.35.tar.gz
Algorithm Hash digest
SHA256 7399fd16c181f6e8a685fc59e9e70def2d65a6c810202a82f2256c0d4bc474a5
MD5 7610a63fb7e48c364fcd7f6007a85f06
BLAKE2b-256 5affcd14ab3526635cc1e8be882dcc52ddf7879af7754d05f5149159e45f92d9

See more details on using hashes here.

File details

Details for the file myxagent-0.2.35-py3-none-any.whl.

File metadata

  • Download URL: myxagent-0.2.35-py3-none-any.whl
  • Upload date:
  • Size: 108.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for myxagent-0.2.35-py3-none-any.whl
Algorithm Hash digest
SHA256 c0bdd1a22352a3d314b8e76710c3d1e56d2a004a9493616489ad3a4456994f21
MD5 bcaf9ae00f2093ca16af5f865176a0d7
BLAKE2b-256 abc31a2385dcdbd1e09c48c5beb634baea8bf8a5180035da6217c12da1991e24

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page