Skip to main content

Multi-Modal AI Agent System

Project description

xAgent

Python FastAPI License

xAgent is a single-agent runtime with three entry points: Python API, CLI, and HTTP server.

  • Chat via CLI, Python API, or HTTP
  • One continuous agent-level message stream
  • Speaker-aware messages via user_id
  • Built-in Web UI and streaming responses
  • Tool calling, MCP integration, and image input
  • Long-term memory enabled by default with local storage

Quick Start

Install

pip install myxagent

Set environment variables

export OPENAI_API_KEY=your_openai_api_key

Start the CLI

xagent-cli

Single-shot mode:

xagent-cli --ask "Hello"

Message Model

Every chat appends to the agent's continuous message stream.

  • user_id identifies the current speaker
  • recent context is pulled from the agent's global recent-message window
  • single-user and multi-user interactions use the same runtime model

HTTP API

Start the server:

xagent-server

Open the Web UI automatically:

xagent-server --open

Send a chat message:

curl -X POST "http://localhost:8010/chat" \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": "alice",
    "user_message": "Remember that my favorite city is Hangzhou."
  }'

Another speaker in the same conversation:

curl -X POST "http://localhost:8010/chat" \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": "bob",
    "user_message": "Please summarize Alice'"'"'s plan and list the top risks."
  }'

Clear the message stream:

curl -X POST "http://localhost:8010/clear_messages"

Image input:

curl -X POST "http://localhost:8010/chat" \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": "user123",
    "user_message": "Describe this image.",
    "image_source": "https://example.com/image.jpg"
  }'

Python API

import asyncio
from xagent.core import Agent


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

    reply = await agent.chat(
        user_message="Hello",
        user_id="alice",
    )
    print(reply)

    follow_up = await agent.chat(
        user_message="Summarize what the conversation has agreed on so far.",
        user_id="bob",
    )
    print(follow_up)


asyncio.run(main())

image_source accepts a single value or a list of values. Each item can be an image URL, local file path, or base64 data URI.

Configure with agent.yaml

Generate a starter config:

xagent-cli --init

Example:

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

  capabilities:
    tools:
      - "web_search"

server:
  host: "0.0.0.0"
  port: 8010

Run with config:

xagent-cli --config config/agent.yaml --toolkit_path my_toolkit
xagent-server --config config/agent.yaml --toolkit_path my_toolkit --open

Documentation

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.42.tar.gz (85.0 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.42-py3-none-any.whl (95.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: myxagent-0.2.42.tar.gz
  • Upload date:
  • Size: 85.0 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.42.tar.gz
Algorithm Hash digest
SHA256 b7684684b63b0dc5852d7fea80adc44faa2fe9163051f3600bc7b20844dac26d
MD5 9fa4336774d829d083ad359243dd3cab
BLAKE2b-256 79e19e6c79739efb2b93314eb1a1fd9b94e8167e035f7e5e1f87e15d4bb9aec6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: myxagent-0.2.42-py3-none-any.whl
  • Upload date:
  • Size: 95.7 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.42-py3-none-any.whl
Algorithm Hash digest
SHA256 0af3117197bdd98366e0710d848b580e359b34d22baf004fa84fe475db0c3d6e
MD5 023ef46afb3cf77b9470fab464ad6651
BLAKE2b-256 7353127777821a0b593d3d03ca29e2a3f847c63128d05ff60c4d1e62c8905629

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