bare-agent 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +56 -2
- package/bin/test-provider.js +61 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -43,6 +43,15 @@ Use bare-agent. The integration guide is in bareagent.context.md.
|
|
|
43
43
|
|
|
44
44
|
That's it. The context doc is structured for LLM consumption — your agent reads it once and knows how to wire every component.
|
|
45
45
|
|
|
46
|
+
**Not sure what you need?** Paste this into any AI assistant:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
I want to build an agent using bare-agent. Read the integration guide at
|
|
50
|
+
node_modules/bare-agent/bareagent.context.md, then ask me up to 5 questions
|
|
51
|
+
about what I need. Based on my answers, tell me which components to use
|
|
52
|
+
and show me the wiring code.
|
|
53
|
+
```
|
|
54
|
+
|
|
46
55
|
---
|
|
47
56
|
|
|
48
57
|
## What's inside
|
|
@@ -68,15 +77,60 @@ Every piece works alone — take what you need, ignore the rest.
|
|
|
68
77
|
|
|
69
78
|
**Tools:** Any function is a tool. REST APIs, MCP servers, CLI commands, browser automation, shell scripts — if it's a function, it works.
|
|
70
79
|
|
|
71
|
-
**Cross-language:** Runs as a subprocess. Communicate via JSONL on stdin/stdout from Python, Go, Rust, or anything that can spawn a process.
|
|
80
|
+
**Cross-language:** Runs as a subprocess. Communicate via JSONL on stdin/stdout from Python, Go, Rust, Ruby, Java, or anything that can spawn a process. Ready-made wrappers in [`contrib/`](contrib/README.md).
|
|
72
81
|
|
|
73
82
|
**Deps:** 0 required. Optional: `cron-parser` (cron expressions), `better-sqlite3` (SQLite store).
|
|
74
83
|
|
|
75
84
|
---
|
|
76
85
|
|
|
86
|
+
## Cross-language usage
|
|
87
|
+
|
|
88
|
+
Not using Node.js? Spawn bare-agent as a subprocess from any language. Ready-made wrappers in [`contrib/`](contrib/README.md) for Python, Go, Rust, Ruby, and Java — copy one file, no package registry needed.
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
# Python — 3 lines to run an agent
|
|
92
|
+
from bareagent import BareAgent
|
|
93
|
+
|
|
94
|
+
agent = BareAgent(provider="openai", model="gpt-4o-mini")
|
|
95
|
+
result = agent.run("What is the capital of France?")
|
|
96
|
+
print(result["text"]) # → "The capital of France is Paris."
|
|
97
|
+
agent.close()
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
```go
|
|
101
|
+
// Go — same pattern
|
|
102
|
+
agent, _ := bareagent.New("anthropic", "claude-haiku-4-5-20251001", "")
|
|
103
|
+
result, _ := agent.Run("What is the capital of France?")
|
|
104
|
+
fmt.Println(result.Text)
|
|
105
|
+
agent.Close()
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
```ruby
|
|
109
|
+
# Ruby — same pattern
|
|
110
|
+
agent = BareAgent.new(provider: "ollama", model: "llama3.2")
|
|
111
|
+
result = agent.run("What is the capital of France?")
|
|
112
|
+
puts result["text"]
|
|
113
|
+
agent.close
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
All wrappers support optional event streaming for intermediate results. See [`contrib/README.md`](contrib/README.md) for Rust, Java, and full protocol reference.
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
77
120
|
## Production-validated
|
|
78
121
|
|
|
79
|
-
|
|
122
|
+
| Component | Aurora (SOAR2) | Multis (assistant) |
|
|
123
|
+
|---|:---:|:---:|
|
|
124
|
+
| Loop | ✓ | ✓ |
|
|
125
|
+
| Planner | ✓ | ✓ |
|
|
126
|
+
| runPlan | ✓ | — |
|
|
127
|
+
| Retry | ✓ | ✓ |
|
|
128
|
+
| CircuitBreaker | — | ✓ |
|
|
129
|
+
| Scheduler | — | ✓ |
|
|
130
|
+
| Checkpoint | — | ✓ |
|
|
131
|
+
| CLIPipe | ✓ | — |
|
|
132
|
+
|
|
133
|
+
Aurora replaced ~400 lines of hand-rolled orchestration with ~60 lines of bare-agent wiring — zero workarounds, zero framework plumbing, 100% domain logic.
|
|
80
134
|
|
|
81
135
|
For wiring recipes and API details, see the **[Integration Guide](bareagent.context.md)** (LLM-optimized). For the full human guide — usage patterns, composition examples, and what bare-agent deliberately doesn't build in (with recipes to do it yourself), see the **[Usage Guide](docs/02-features/usage-guide.md)**. For error reference, see **[Error Guide](docs/02-features/errors.md)**. For release history, see **[CHANGELOG](CHANGELOG.md)**.
|
|
82
136
|
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const args = process.argv.slice(2);
|
|
5
|
+
const flag = (name) => {
|
|
6
|
+
const i = args.indexOf(`--${name}`);
|
|
7
|
+
return i >= 0 ? args[i + 1] : undefined;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const providerName = flag('provider') || 'openai';
|
|
11
|
+
const model = flag('model');
|
|
12
|
+
|
|
13
|
+
function createProvider() {
|
|
14
|
+
if (providerName === 'openai') {
|
|
15
|
+
const { OpenAIProvider } = require('../src/provider-openai');
|
|
16
|
+
return new OpenAIProvider({
|
|
17
|
+
apiKey: process.env.OPENAI_API_KEY,
|
|
18
|
+
...(model && { model }),
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
if (providerName === 'anthropic') {
|
|
22
|
+
const { AnthropicProvider } = require('../src/provider-anthropic');
|
|
23
|
+
return new AnthropicProvider({
|
|
24
|
+
apiKey: process.env.ANTHROPIC_API_KEY,
|
|
25
|
+
...(model && { model }),
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
if (providerName === 'ollama') {
|
|
29
|
+
const { OllamaProvider } = require('../src/provider-ollama');
|
|
30
|
+
return new OllamaProvider({
|
|
31
|
+
...(model && { model }),
|
|
32
|
+
...(flag('url') && { url: flag('url') }),
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
console.error(`Unknown provider: ${providerName}`);
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async function main() {
|
|
40
|
+
const provider = createProvider();
|
|
41
|
+
const prompt = [{ role: 'user', content: 'Reply with exactly: ok' }];
|
|
42
|
+
|
|
43
|
+
console.log(`Testing ${providerName}${model ? ` (${model})` : ''}...`);
|
|
44
|
+
|
|
45
|
+
try {
|
|
46
|
+
const result = await provider.generate(prompt, []);
|
|
47
|
+
console.log(`PASS — Response: "${result.text.trim()}"`);
|
|
48
|
+
if (result.usage) {
|
|
49
|
+
console.log(` Tokens: ${result.usage.inputTokens} in / ${result.usage.outputTokens} out`);
|
|
50
|
+
}
|
|
51
|
+
} catch (err) {
|
|
52
|
+
console.error(`FAIL — ${err.message}`);
|
|
53
|
+
if (err.status === 401 || err.status === 403) {
|
|
54
|
+
console.error(' Check your API key. Expected env var:');
|
|
55
|
+
console.error(` ${providerName === 'anthropic' ? 'ANTHROPIC_API_KEY' : 'OPENAI_API_KEY'}`);
|
|
56
|
+
}
|
|
57
|
+
process.exit(1);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
main();
|