Skip to content

Commit d5c3b97

Browse files
authored
docs: organize codebase for OSS standards (#8)
- Move codeagent_retry.go to codeagent/ package - Move ARCHITECTURE.md to docs/ - Move plans/ to docs/guides/ - Add docs/README.md documentation index - Add examples/ with basic, streaming, and multi-provider examples - Update README.md with docs and examples sections
1 parent 7bc4daa commit d5c3b97

9 files changed

Lines changed: 230 additions & 12 deletions

File tree

README.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@
1919
<p align="center">
2020
<a href="#quick-start">Quick Start</a> ·
2121
<a href="#features">Features</a> ·
22+
<a href="#documentation">Docs</a> ·
23+
<a href="#examples">Examples</a> ·
2224
<a href="#supported-providers">Providers</a> ·
23-
<a href="#usage">Usage</a> ·
2425
<a href="#architecture">Architecture</a> ·
2526
<a href="#contributing">Contributing</a>
2627
</p>
@@ -100,6 +101,28 @@ Token bucket rate limiter per provider — prevents hitting API limits before th
100101

101102
Built-in cost estimation per call, with per-provider pricing from the embedded model catalog.
102103

104+
## Documentation
105+
106+
Detailed documentation is available in the [docs/](docs/) directory:
107+
108+
- **[Architecture](docs/ARCHITECTURE.md)** — System design, data flow, and reliability features
109+
- **[Provider Setup Guide](docs/guides/CREDENTIAL-SETUP-FLOW.md)** — Credential configuration and provider setup
110+
- **[Dynamic Model Discovery](docs/guides/DYNAMIC-MODEL-DISCOVERY.md)** — Live model discovery architecture
111+
112+
## Examples
113+
114+
Runnable examples are in the [examples/](examples/) directory:
115+
116+
- **[Basic Chat](examples/basic/)** — Simple synchronous chat
117+
- **[Streaming](examples/streaming/)** — SSE streaming with event handling
118+
- **[Multi-Provider](examples/multi-provider/)** — Fallback chains across providers
119+
120+
Run any example with:
121+
122+
```bash
123+
ANTHROPIC_API_KEY=sk-... go run ./examples/basic/
124+
```
125+
103126
## Supported Providers
104127

105128
| Provider | Env Variable | Notes |
@@ -179,8 +202,11 @@ eyrie/
179202
│ ├── legacy/ # Legacy model support
180203
│ ├── live/ # Live model data
181204
│ └── registry/ # Model registry
205+
├── codeagent/ # Code agent retry & fallback strategies
182206
├── conversation/ # Conversation engine with branching
183207
├── credentials/ # Credential management
208+
├── docs/ # Documentation & guides
209+
├── examples/ # Runnable code examples
184210
├── router/ # Weighted provider router
185211
├── runtime/ # Runtime manifest & routing policies
186212
├── storage/ # SQLite conversation DAG store
@@ -198,6 +224,8 @@ eyrie/
198224
└── assets/ # Logo and branding
199225
```
200226

227+
See [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) for detailed system design and data flows.
228+
201229
## Ecosystem
202230

203231
eyrie is part of the hawk-eco:
Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
1-
// Package eyrie is a universal LLM provider runtime. It routes requests to
2-
// multiple AI providers (Anthropic, OpenAI, Gemini, Azure, Bedrock, Vertex,
3-
// and OpenAI-compatible endpoints) with reliability features: circuit breaker,
4-
// request coalescing, output guardrails (PII / secrets / injection),
5-
// structured-output validation with retry, request-scoped lifecycle callbacks,
6-
// and code-agent–specific retry strategies.
7-
//
8-
// This file (codeagent_retry.go) implements intelligent retry and fallback
9-
// policies tailored to code agent workloads, distinguishing rate-limit errors,
10-
// context window overflows, and tool-call failures from generic errors.
11-
package eyrie
1+
// Package codeagent provides intelligent retry and fallback strategies
2+
// tailored to code agent workloads. It distinguishes rate-limit errors,
3+
// context window overflows, and tool-call failures from generic errors,
4+
// applying appropriate retry or model-fallback behavior for each.
5+
package codeagent
126

137
import (
148
"context"
File renamed without changes.

docs/README.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# Eyrie Documentation
2+
3+
Welcome to the Eyrie documentation. This directory contains detailed guides and reference material for the Universal LLM Provider Runtime.
4+
5+
## Documentation Index
6+
7+
### Core Documentation
8+
9+
- **[Architecture](ARCHITECTURE.md)** — System architecture, data flow, and design decisions
10+
- **[Provider Setup Guide](guides/CREDENTIAL-SETUP-FLOW.md)** — How to configure credentials and providers
11+
- **[Dynamic Model Discovery](guides/DYNAMIC-MODEL-DISCOVERY.md)** — Architecture and implementation details for live model discovery
12+
13+
### Quick Links
14+
15+
- **[README](../README.md)** — Project overview and quick start
16+
- **[Contributing Guide](../CONTRIBUTING.md)** — How to contribute to Eyrie
17+
- **[Security Policy](../SECURITY.md)** — Security reporting and best practices
18+
- **[Changelog](../CHANGELOG.md)** — Version history and release notes
19+
20+
### Examples
21+
22+
The [`examples/`](../examples/) directory contains runnable code samples:
23+
24+
- **Basic Chat** — Simple synchronous chat with a single provider
25+
- **Streaming** — Server-sent events streaming with continuation
26+
- **Multi-Provider** — Using fallback chains across multiple providers
27+
28+
## Documentation Structure
29+
30+
```
31+
docs/
32+
├── README.md # This file
33+
├── ARCHITECTURE.md # System architecture
34+
└── guides/
35+
├── CREDENTIAL-SETUP-FLOW.md # Credential configuration
36+
└── DYNAMIC-MODEL-DISCOVERY.md # Model discovery architecture
37+
```
38+
39+
## For Developers
40+
41+
If you're contributing to Eyrie:
42+
43+
1. Read [CONTRIBUTING.md](../CONTRIBUTING.md) for development setup
44+
2. Review [ARCHITECTURE.md](ARCHITECTURE.md) to understand the system
45+
3. Check [AGENTS.md](../AGENTS.md) for AI agent context and conventions
46+
4. Run `make ci` locally before submitting PRs
47+
48+
## For Users
49+
50+
If you're using Eyrie in your application:
51+
52+
1. Start with the [Quick Start](../README.md#quick-start) in the main README
53+
2. Review the [Usage examples](../README.md#usage) for common patterns
54+
3. Check the [examples/](../examples/) directory for complete code samples
55+
4. Read the [Provider Setup Guide](guides/CREDENTIAL-SETUP-FLOW.md) for credential configuration
56+
57+
## API Reference
58+
59+
API documentation is available at:
60+
- **[pkg.go.dev](https://pkg.go.dev/github.com/GrayCodeAI/eyrie)** — Generated Go documentation
61+
- **[ARCHITECTURE.md](ARCHITECTURE.md)** — Core abstractions and interfaces
62+
63+
## Support
64+
65+
- **Issues**: [GitHub Issues](https://github.com/GrayCodeAI/eyrie/issues)
66+
- **Discussions**: [GitHub Discussions](https://github.com/GrayCodeAI/eyrie/discussions)
67+
- **Security**: See [SECURITY.md](../SECURITY.md) for vulnerability reporting
File renamed without changes.
File renamed without changes.

examples/basic/main.go

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Example: basic chat with eyrie.
2+
//
3+
// Run:
4+
//
5+
// ANTHROPIC_API_KEY=sk-... go run ./examples/basic/
6+
package main
7+
8+
import (
9+
"context"
10+
"fmt"
11+
"os"
12+
13+
"github.com/GrayCodeAI/eyrie/client"
14+
)
15+
16+
func main() {
17+
c := client.Client(&client.EyrieConfig{
18+
Provider: client.DetectProvider(),
19+
})
20+
21+
messages := []client.EyrieMessage{
22+
{Role: "user", Content: "What is 2 + 2?"},
23+
}
24+
25+
resp, err := c.Chat(context.Background(), messages, client.ChatOptions{
26+
Model: "claude-sonnet-4-6",
27+
})
28+
if err != nil {
29+
fmt.Fprintf(os.Stderr, "chat error: %v\n", err)
30+
os.Exit(1)
31+
}
32+
33+
fmt.Println(resp.Content)
34+
fmt.Printf("Tokens: input=%d output=%d\n", resp.Usage.PromptTokens, resp.Usage.CompletionTokens)
35+
}

examples/multi-provider/main.go

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// Example: multi-provider fallback chain.
2+
//
3+
// Tries Anthropic first, falls back to OpenAI, then Gemini.
4+
//
5+
// Run:
6+
//
7+
// ANTHROPIC_API_KEY=sk-ant-... OPENAI_API_KEY=sk-... go run ./examples/multi-provider/
8+
package main
9+
10+
import (
11+
"context"
12+
"fmt"
13+
"os"
14+
15+
"github.com/GrayCodeAI/eyrie/client"
16+
)
17+
18+
func main() {
19+
primary := client.Client(&client.EyrieConfig{
20+
Provider: "anthropic",
21+
})
22+
secondary := client.Client(&client.EyrieConfig{
23+
Provider: "openai",
24+
})
25+
26+
messages := []client.EyrieMessage{
27+
{Role: "user", Content: "Explain what a fallback chain is in one sentence."},
28+
}
29+
30+
// Try primary first, fall back to secondary on failure.
31+
resp, err := primary.Chat(context.Background(), messages, client.ChatOptions{
32+
Model: "claude-sonnet-4-6",
33+
})
34+
if err != nil {
35+
fmt.Fprintf(os.Stderr, "primary failed, trying secondary: %v\n", err)
36+
resp, err = secondary.Chat(context.Background(), messages, client.ChatOptions{
37+
Model: "gpt-4o",
38+
})
39+
if err != nil {
40+
fmt.Fprintf(os.Stderr, "all providers failed: %v\n", err)
41+
os.Exit(1)
42+
}
43+
}
44+
45+
fmt.Println(resp.Content)
46+
}

examples/streaming/main.go

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// Example: streaming chat with auto-continuation.
2+
//
3+
// Run:
4+
//
5+
// ANTHROPIC_API_KEY=sk-... go run ./examples/streaming/
6+
package main
7+
8+
import (
9+
"context"
10+
"fmt"
11+
"os"
12+
13+
"github.com/GrayCodeAI/eyrie/client"
14+
)
15+
16+
func main() {
17+
c := client.Client(&client.EyrieConfig{
18+
Provider: client.DetectProvider(),
19+
})
20+
21+
messages := []client.EyrieMessage{
22+
{Role: "user", Content: "Write a short poem about programming."},
23+
}
24+
25+
sr, err := c.StreamChat(context.Background(), messages, client.ChatOptions{
26+
Model: "claude-sonnet-4-6",
27+
})
28+
if err != nil {
29+
fmt.Fprintf(os.Stderr, "stream error: %v\n", err)
30+
os.Exit(1)
31+
}
32+
defer sr.Close()
33+
34+
for evt := range sr.Events {
35+
switch evt.Type {
36+
case "content":
37+
fmt.Print(evt.Content)
38+
case "tool_call":
39+
if evt.ToolCall != nil {
40+
fmt.Printf("\n[Tool call: %s]\n", evt.ToolCall.Name)
41+
}
42+
case "done":
43+
fmt.Println()
44+
case "error":
45+
fmt.Fprintf(os.Stderr, "\nstream error: %s\n", evt.Error)
46+
}
47+
}
48+
}

0 commit comments

Comments
 (0)