Metadata-Version: 2.4
Name: agent-framework-ep
Version: 0.1.1
Summary: Microsoft Agent Framework extensions for mainstream open-source LLMs
Project-URL: Repository, https://github.com/qianpeng/agent-framework-ep
Author-email: Peng Qian <qianpeng@example.com>
License: MIT
License-File: LICENSE
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.12
Requires-Dist: agent-framework>=1.0.0rc5
Requires-Dist: dirtyjson>=0.0.0
Requires-Dist: docker>=7.0
Requires-Dist: json-repair>=0.0.0
Provides-Extra: dev
Requires-Dist: httpx>=0.27; extra == 'dev'
Requires-Dist: mypy>=1.8; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
Requires-Dist: pytest-cov>=4.0; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.3; extra == 'dev'
Description-Content-Type: text/markdown

# 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

```bash
pip install agent-framework-ep
```

Or with uv:

```bash
uv add agent-framework-ep
```

### Prerequisites

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

## Quick Start

### OpenAI-like Client with Structured Output

```python
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

```python
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

```python
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

```bash
# 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](LICENSE) for details.
