update README.md
This commit is contained in:
67
README.md
67
README.md
@@ -10,8 +10,73 @@ A DSPy module that wraps the OpenAI Codex SDK with a signature-driven interface.
|
||||
- **Rich outputs** - Get typed results + execution trace + token usage
|
||||
- **Multi-turn conversations** - Context preserved across calls
|
||||
- **Output field descriptions** - Automatically enhance prompts
|
||||
- **Modaic integration** - Deploy and share agents on the Modaic hub
|
||||
|
||||
## Installation
|
||||
## Quick Start with Modaic
|
||||
|
||||
The fastest way to use CodexAgent is through [Modaic](https://docs.modaic.dev/), which allows you to pull pre-packaged agents from the hub.
|
||||
|
||||
### 1. Set up environment variables
|
||||
|
||||
Create a `.env` file with your API keys:
|
||||
|
||||
```bash
|
||||
# Copy the example file
|
||||
cp .env.example .env
|
||||
|
||||
# Edit .env with your keys
|
||||
MODAIC_TOKEN="<YOUR_MODAIC_TOKEN>"
|
||||
CODEX_API_KEY="<YOUR_CODEX_API_KEY>"
|
||||
```
|
||||
|
||||
- Get your **MODAIC_TOKEN** from [Modaic dashboard](https://modaic.dev/)
|
||||
- Get your **CODEX_API_KEY** (OpenAI API key) from [OpenAI platform](https://platform.openai.com/api-keys)
|
||||
|
||||
### 2. Install dependencies
|
||||
|
||||
```bash
|
||||
pip install modaic dspy python-dotenv
|
||||
```
|
||||
|
||||
### 3. Use the agent
|
||||
|
||||
```python
|
||||
from modaic import AutoAgent
|
||||
import dspy
|
||||
from pydantic import BaseModel
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv()
|
||||
|
||||
class Dependencies(BaseModel):
|
||||
dependencies: list[str]
|
||||
|
||||
def main():
|
||||
sig = dspy.Signature("message:str -> answer:Dependencies")
|
||||
codex_agent = AutoAgent.from_precompiled(
|
||||
"darinkishore/codex-agent",
|
||||
config_options={
|
||||
"signature": sig,
|
||||
"working_directory": ".",
|
||||
"model": "gpt-4o",
|
||||
"codex_path_override": "/opt/homebrew/bin/codex" # Optional: customize codex binary path
|
||||
},
|
||||
)
|
||||
|
||||
result = codex_agent(message="check the pyproject.toml for this projects dependencies")
|
||||
print(result.answer.dependencies) # Typed Pydantic output
|
||||
print(result.trace) # Execution items (commands, files, etc.)
|
||||
print(result.usage) # Token counts
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
```
|
||||
|
||||
**Note**: Make sure the Codex CLI is installed and accessible. On macOS with Homebrew, it's typically at `/opt/homebrew/bin/codex`. Use `which codex` to find your path.
|
||||
|
||||
## Local Installation & Development
|
||||
|
||||
If you want to develop or modify the agent locally:
|
||||
|
||||
```bash
|
||||
# Install dependencies
|
||||
|
||||
2
main.py
2
main.py
@@ -7,7 +7,7 @@ codex_agent = CodexAgent(CodexAgentConfig())
|
||||
|
||||
|
||||
def main():
|
||||
codex_agent.push_to_hub("darinkishore/codex-agent", with_code=True, commit_message="fix thread error")
|
||||
codex_agent.push_to_hub("darinkishore/codex-agent", with_code=True, commit_message="update README.md")
|
||||
#result = codex_agent(message="What files are in this directory?")
|
||||
#print(result.answer) # String response
|
||||
#print(result.trace) # Execution items (commands, files, etc.)
|
||||
|
||||
Reference in New Issue
Block a user