Metadata-Version: 2.4
Name: hunt-sdk
Version: 0.1.0
Summary: Python SDK for Hunt — the open-source agent harness
Project-URL: Homepage, https://huntinference.com
Project-URL: Documentation, https://huntinference.com/docs
Project-URL: Repository, https://github.com/filipegouveia2-del/hunt-inference
Author-email: Hunt <support@huntinference.com>
License-Expression: MIT
Keywords: agent-harness,agents,ai,arm,hunt,llm,openai
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.9
Requires-Dist: httpx>=0.25.0
Requires-Dist: openai>=1.0.0
Description-Content-Type: text/markdown

# Hunt Python SDK

Agent-native AI inference. Retry, budget control, and cost tracking built in.

## Install

```bash
pip install hunt-sdk
```

## Quick start

```python
from hunt import HuntClient

client = HuntClient(api_key="hunt_sk_live_...")

response = client.chat("What is ARM architecture?")
print(response)
print(client.usage)  # TokenUsage(requests=1, tokens=142, cost=$0.000047)
```

## Agent runs

Run multi-step agent workflows with automatic budget control:

```python
from hunt import HuntClient, Agent

client = HuntClient(api_key="hunt_sk_live_...")

agent = Agent(
    client=client,
    system="You are a data analyst. Be concise.",
    max_steps=10,
    budget=0.05,  # stop if cost exceeds $0.05
)

run = agent.run("What are the top 3 trends in AI infrastructure?")

print(run.final_output)
print(run.summary())
# {'run_id': 'a1b2c3d4e5f6', 'model': 'hunt-llama-3.1-8b', 'status': 'success',
#  'steps': 1, 'total_tokens': '285', 'total_cost': '$0.000094',
#  'total_latency': '823ms', 'budget': '$0.05'}
```

## Agent with tools

```python
def search(query: str) -> str:
    """Search the web for information."""
    return f"Results for: {query}..."

def calculate(expression: str) -> str:
    """Evaluate a math expression."""
    return str(eval(expression))

agent = Agent(
    client=client,
    system="You are a research assistant with access to search and calculation tools.",
    tools={"search": search, "calculate": calculate},
    max_steps=20,
    budget=0.10,
)

run = agent.run("How many tokens can a 80-core Ampere Altra process per month?")
print(run.final_output)

# See every step
for step in run.steps:
    print(f"  [{step.role}] {step.content[:80]}... (${step.cost_usd:.6f})")
```

## Step callbacks

Monitor agent execution in real-time:

```python
def on_step(step):
    if step.role == "assistant":
        print(f"Step {step.index}: {step.content[:60]}... (${step.cost_usd:.6f})")
    elif step.role == "tool":
        print(f"  Tool [{step.tool_call}]: {step.content[:60]}...")

agent = Agent(
    client=client,
    on_step=on_step,
    max_steps=15,
    budget=0.10,
)

run = agent.run("Analyze the cost of running Llama 8B on ARM vs GPU")
```

## Models

All models are $0.02 per agent run (15K tokens included). Overage: $0.003/1K tokens above 15K.

| Model | Size | Context | Best For |
|-------|------|---------|----------|
| `hunt-llama-3.1-8b` | 8B | 128K | General-purpose agents |
| `hunt-mistral-7b` | 7B | 32K | Fast single-step tasks |
| `hunt-qwen-2.5-7b` | 7B | 128K | Multilingual agents |

## OpenAI SDK compatibility

Hunt is a drop-in replacement. Use the OpenAI SDK directly:

```python
from openai import OpenAI

client = OpenAI(
    base_url="https://api.huntinference.com/v1",
    api_key="hunt_sk_live_...",
)

# Works exactly the same
response = client.chat.completions.create(
    model="hunt-llama-3.1-8b",
    messages=[{"role": "user", "content": "Hello"}],
)
```

The Hunt SDK adds retry logic, budget control, and cost tracking on top.

## License

MIT
