minicode_usagelisted
Install: claude install-skill juancok888/minicode-sdk
# minicode-sdk Usage Guide
## Installation
```bash
pip install minicode-sdk
```
## Quick Start
### Basic Agent
```python
import asyncio
from minicode import Agent
from minicode.llm import OpenAILLM
async def main():
agent = Agent(
name="assistant",
llm=OpenAILLM(api_key="your-api-key"),
)
response = await agent.generate("Hello, how are you?")
print(response)
asyncio.run(main())
```
### Streaming Response
```python
async def main():
agent = Agent(name="assistant", llm=OpenAILLM(api_key="your-key"))
async for chunk in agent.stream("Tell me a story"):
if chunk["type"] == "content":
print(chunk["content"], end="", flush=True)
```
## Adding Tools
### Built-in Tools
```python
from minicode.tools.builtin import ReadTool, WriteTool, BashTool
agent = Agent(
name="assistant",
llm=my_llm,
tools=[ReadTool(), WriteTool(), BashTool()],
)
```
### Custom Tools
```python
from minicode.tools.base import BaseTool
class MyTool(BaseTool):
@property
def name(self) -> str:
return "my_tool"
@property
def description(self) -> str:
return "Description of what this tool does"
@property
def parameters(self) -> dict:
return {
"type": "object",
"properties": {
"param1": {"type": "string", "description": "First parameter"},
},
"required": ["param1"],
}
async def execute(self, params: dict, con