Skip to main content

Microsoft Agent Framework extensions for mainstream open-source LLMs

Project description

agent-framework-ep

Microsoft Agent Framework extensions for mainstream open-source LLMs, including structured output support for GLM, Kimi, Qwen, and DeepSeek, along with reasoning_content support. Plus a local containerized code interpreter environment. 'ep' stands for enterprise-level applications.

Features

  • OpenAI-like Client Extensions (openai_like)

    • Structured output parsing with JSON fallback (dirtyjson, json-repair)
    • Reasoning content support for DeepSeek-R1 style models
    • Compatible with Microsoft Agent Framework's OpenAIChatClient
  • Code Executor (code_executor)

    • Docker-based code execution environment
    • Supports Python, bash, and shell scripts
    • Timeout and cancellation support
    • Isolated execution for security
  • Dynamic Skills Provider (skills_provider)

    • Async skill updates before each agent run
    • Extendable skills from external sources

Installation

pip install agent-framework-ep

Or with uv:

uv add agent-framework-ep

Prerequisites

  • Python 3.12+
  • Docker (for code execution features)

Quick Start

OpenAI-like Client with Structured Output

from pydantic import BaseModel
from agent_framework import Agent
from agent_framework_ep import OpenAILikeChatClient

class Response(BaseModel):
    answer: str
    confidence: float

# Create client with structured output support
client = OpenAILikeChatClient(
    model="deepseek-chat",
    api_key="your-api-key"
)

# Use with Agent framework
agent = Agent(client=client)
response = await agent.run(
    "What is the capital of France?",
    response_format=Response
)
print(response.result)  # Parsed Response object

Code Execution

import asyncio
from agent_framework_ep import DockerCommandLineCodeExecutor, CodeBlock, CancellationToken

async def main():
    async with DockerCommandLineCodeExecutor(
        image="python-code-sandbox"
    ) as executor:
        result = await executor.execute_code_blocks(
            [CodeBlock(code="print('Hello, World!')", language="python")],
            CancellationToken()
        )
        print(result.output)  # Hello, World!
        print(result.exit_code)  # 0

asyncio.run(main())

Dynamic Skills Provider

from agent_framework_ep import UpdatableSkillsProvider
from agent_framework import Skill

async def fetch_dynamic_skills():
    # Fetch skills from external source
    return [
        Skill(name="web-search", description="Search the web", content="..."),
    ]

provider = UpdatableSkillsProvider(
    skill_paths="./skills",
    skills_updater=fetch_dynamic_skills
)

Development

# Clone the repository
git clone https://github.com/qianpeng/agent-framework-ep.git
cd agent-framework-ep

# Install dependencies
uv sync

# Run tests
uv run pytest

# Run tests with Docker (requires Docker)
uv run pytest -m docker

# Lint and format
uv run ruff check --fix .
uv run ruff format .

# Type check
uv run mypy src/agent_framework_ep

License

MIT License - see LICENSE for details.

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

agent_framework_ep-0.1.2.tar.gz (32.9 kB view details)

Uploaded Source

Built Distribution

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

agent_framework_ep-0.1.2-py3-none-any.whl (18.4 kB view details)

Uploaded Python 3

File details

Details for the file agent_framework_ep-0.1.2.tar.gz.

File metadata

  • Download URL: agent_framework_ep-0.1.2.tar.gz
  • Upload date:
  • Size: 32.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.15

File hashes

Hashes for agent_framework_ep-0.1.2.tar.gz
Algorithm Hash digest
SHA256 926ca0891c4e39fd81bf32b30dfd9b6c8fdcafe3e33869972d8dc891f4849433
MD5 e89797e5a057a4c24496a99164ea58a6
BLAKE2b-256 2ff0aacbe889dbe321f2f1a7d3495587c02ec993727a654c3cbb9efd919bb9ae

See more details on using hashes here.

File details

Details for the file agent_framework_ep-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for agent_framework_ep-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 abde2c606854b6a27b5b8a91e735e83bdef5eeea09e21256fd034c90fc1ca328
MD5 3e9afbad4fb6fefef102e63a5fdc5d52
BLAKE2b-256 19c5da17eb24fb064233f5efd2bf4046b9ab89ee072eadcbf038d29e1fb002bd

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