Skip to main content

Multi-Modal AI Agent System

Project description

xAgent

Python FastAPI Redis 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"

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-4.1-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-4.1-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-4.1-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.34.tar.gz (88.8 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.34-py3-none-any.whl (105.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: myxagent-0.2.34.tar.gz
  • Upload date:
  • Size: 88.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for myxagent-0.2.34.tar.gz
Algorithm Hash digest
SHA256 5395bfb10a2d1e8ea779812df8a737b4a7c93f13d0eae3f1ed73652e67c229b9
MD5 0f52bf2bcccfab5f04e1cd36276c1eea
BLAKE2b-256 a43ab00ad5e465765ef7ede682843c0bcedd1ba150ae6547b5e0cd9edc48d7c6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: myxagent-0.2.34-py3-none-any.whl
  • Upload date:
  • Size: 105.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for myxagent-0.2.34-py3-none-any.whl
Algorithm Hash digest
SHA256 b7c2fc0d2cc9dc977e957227c2b97d1ee91a4e7af8d646e78363d9682d1c734a
MD5 42bbeeedd75cf629f7945542c4ef990e
BLAKE2b-256 5d960a9925c25617d9dd96855c14012676b7aab9a2f854dd8f5e14ba6ad5e55e

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