Skip to main content

A custom GenAI agent framework

Project description

Phoenix Agents

A framework for building AI agents with modular connectors and LLM integration.

Installation

pip install phoenix-agents

Features

  • Modular connector system for agent interactions
  • Built-in support for Azure AI and OpenAI
  • Chat history management
  • Extensible agent architecture
  • Session management for multi-user scenarios

Quick Start

Here's a simple example using Phoenix to create a simple AI agent:

from dotenv import load_dotenv
import asyncio
import os

from phoenix.agent import Agent
from phoenix.user_session import UserSession
from phoenix.models.azure_ai_inference import AzureAIInferece
import phoenix.models.openai_history as openai_history

load_dotenv()

async def main():
    # Initialize chat history
    chat_history = openai_history.ChatHistory()

    # Setup LLM with Azure AI
    llm = AzureAIInferece(
        token=os.getenv("GITHUB_TOKEN"),
        history=chat_history
    )

    # Create agent
    agent = Agent(
        brain=llm,
        history=chat_history,
    )

    # Create user session and interact
    session = UserSession()
    response = await agent.call("Hello, how are you?", session)
    print(response)

if __name__ == "__main__":
    asyncio.run(main())

Here's a simple example using Phoenix to create a moody AI agent with MCP connectors (The full example can be found in Moody AI Repository):

from dotenv import load_dotenv
import asyncio
import os

from phoenix.agent import Agent
from phoenix.user_session import UserSession
from phoenix.models.azure_ai_inference import AzureAIInferece
import phoenix.models.openai_history as openai_history
from phoenix.connectors.mcp import MCPClient, MCPServer

load_dotenv()

async def main():
    # Initialize chat history
    chat_history = openai_history.ChatHistory()

    # Setup LLM with Azure AI
    llm = AzureAIInferece(
        token=os.getenv("GITHUB_TOKEN"),
        history=chat_history
    )

    # Setup MCP connector with servers
    mcp = MCPClient([
        MCPServer(path="path/to/mood.py")
    ])

    try:
        await mcp.connect()

        # Create agent
        agent = Agent(
            brain=llm,
            history=chat_history,
            connector=mcp,
            system="You are a moody AI, you need to know your current mood to know how to respond.",
        )

        # Create user session and interact
        session = UserSession()
        response = await agent.call("Hello, how are you?", session)
        print(response)

    finally:
        await mcp.cleanup()

if __name__ == "__main__":
    asyncio.run(main())

Configuration

The framework uses environment variables for configuration. Create a .env file with:

GITHUB_TOKEN=your_token_here

Contributing

Contributions are welcome!

License

MIT

Documentation

TODO

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

phoenix_agents-0.1.6.tar.gz (17.9 kB view details)

Uploaded Source

Built Distribution

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

phoenix_agents-0.1.6-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file phoenix_agents-0.1.6.tar.gz.

File metadata

  • Download URL: phoenix_agents-0.1.6.tar.gz
  • Upload date:
  • Size: 17.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for phoenix_agents-0.1.6.tar.gz
Algorithm Hash digest
SHA256 0f9a1c9a126ecbeacf562db4ebab1427a6a2654ab944cd5a2534f64eff59ad29
MD5 e801b13ec86167688f524c6c19236419
BLAKE2b-256 045130a4186e2dea99bc3d1d12bf81d34ed6b67a3b1c99a0a8ce01c829a3718d

See more details on using hashes here.

Provenance

The following attestation bundles were made for phoenix_agents-0.1.6.tar.gz:

Publisher: publish.yml on Nie-Mand/phoenix-agents

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file phoenix_agents-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: phoenix_agents-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for phoenix_agents-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 e29f4d3cb22d5e1f6fb064f44d56035bb370114a8c579976a7dea489037c9b96
MD5 22f0eeed653cef4104a3f842060c753d
BLAKE2b-256 766519daecc28022c5b1c94029b46ce3fb281b78c20666e8e535da4204dc123b

See more details on using hashes here.

Provenance

The following attestation bundles were made for phoenix_agents-0.1.6-py3-none-any.whl:

Publisher: publish.yml on Nie-Mand/phoenix-agents

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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