Skip to content

Commit 165605e

Browse files
authored
docs(tarko-agent-cli): optimize README.md (#1578)
1 parent 76da098 commit 165605e

File tree

1 file changed

+6
-165
lines changed

1 file changed

+6
-165
lines changed

multimodal/tarko/agent-cli/README.md

Lines changed: 6 additions & 165 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Agent CLI
1+
# Tarko Agent CLI
22

3-
A flexible Agent CLI framework built on top of the **Agent Kernel**. Deploy and run agents with ease, featuring built-in Web UI and powerful extensibility.
3+
A flexible Agent CLI framework built on top of the **Agent Kernel** ([`@tarko/agent`](https://www.npmjs.com/package/@tarko/agent)). Deploy and run agents with ease, featuring built-in Web UI and powerful extensibility.
44

55
## Quick Start
66

@@ -142,19 +142,7 @@ tarko --workspace ./my-workspace
142142
tarko --debug
143143
```
144144

145-
### Environment Variables
146145

147-
Create `.env.local` or `.env` in project root:
148-
149-
```bash
150-
OPENAI_API_KEY="your-api-key"
151-
```
152-
153-
Or export in shell:
154-
155-
```bash
156-
export OPENAI_API_KEY="your-api-key"
157-
```
158146

159147
### Priority Order
160148

@@ -166,104 +154,7 @@ export OPENAI_API_KEY="your-api-key"
166154

167155
## Custom Development
168156

169-
### Creating Custom CLI
170-
171-
```typescript
172-
// my-cli.ts
173-
import { AgentCLI, AgentCLIInitOptions } from '@tarko/agent-cli';
174-
import { MyAgent } from './my-agent';
175-
176-
class MyCLI extends AgentCLI {
177-
constructor() {
178-
super({
179-
version: '1.0.0',
180-
buildTime: Date.now(),
181-
gitHash: 'abc123',
182-
binName: 'my-agent',
183-
defaultAgent: {
184-
agentConstructor: MyAgent,
185-
agentName: 'My Agent',
186-
},
187-
});
188-
}
189-
190-
// Add custom CLI options
191-
protected configureAgentCommand(command: CLICommand): CLICommand {
192-
return command
193-
.option('--custom-option <value>', 'Custom option')
194-
.option('--feature.enable', 'Enable feature');
195-
}
196-
197-
// Custom welcome message
198-
protected printLogo(): void {
199-
printWelcomeLogo(
200-
'My Agent',
201-
'1.0.0',
202-
'My custom agent description',
203-
['Custom ASCII art lines'],
204-
'https://my-agent.com',
205-
);
206-
}
207-
208-
// Add custom commands
209-
protected extendCli(cli: CLIInstance): void {
210-
cli
211-
.command('analyze', 'Analysis command')
212-
.option('--deep', 'Deep analysis')
213-
.action(async (options) => {
214-
// Custom command logic
215-
});
216-
}
217-
}
218-
219-
// Bootstrap CLI
220-
new MyCLI().bootstrap();
221-
```
222-
223-
### Agent Implementation
224-
225-
Create custom agents by implementing the `IAgent` interface:
226-
227-
```typescript
228-
import { IAgent, AgentOptions, AgentEventStream } from '@tarko/agent-interface';
229-
230-
export class MyAgent implements IAgent {
231-
constructor(private options: AgentOptions) {}
232-
233-
async initialize(): Promise<void> {
234-
// Initialization logic
235-
}
236-
237-
async run(input: string): Promise<AgentEventStream.AssistantMessageEvent> {
238-
// Agent execution logic
239-
return {
240-
id: 'msg-1',
241-
type: 'assistant_message',
242-
timestamp: Date.now(),
243-
content: 'My response',
244-
};
245-
}
246-
247-
// Implement other required methods...
248-
}
249-
```
250-
251-
### Configuration Processing
252-
253-
Extend configuration handling with **CLI options enhancer**:
254-
255-
```typescript
256-
protected configureCLIOptionsEnhancer(): CLIOptionsEnhancer | undefined {
257-
return (cliArguments, appConfig) => {
258-
if (cliArguments.customOption) {
259-
appConfig.customFeature = {
260-
enabled: true,
261-
value: cliArguments.customOption,
262-
};
263-
}
264-
};
265-
}
266-
```
157+
_Coming soon_
267158

268159
## Advanced Features
269160

@@ -327,67 +218,17 @@ tarko --tool.include "file_*,web_*" --tool.exclude "dangerous_*"
327218
tarko --mcpServer.include "filesystem" --mcpServer.exclude "experimental_*"
328219
```
329220

330-
## Deployment
331221

332-
### Docker
333222

334-
```dockerfile
335-
FROM node:18-alpine
336-
WORKDIR /app
337-
COPY package.json .
338-
RUN npm install
339-
COPY . .
340-
EXPOSE 8888
341-
CMD ["tarko", "serve", "--port", "8888"]
342-
```
343-
344-
### Process Management
345-
346-
```bash
347-
# PM2
348-
pm2 start tarko --name "my-agent" -- serve --port 8888
349-
350-
# systemd
351-
sudo systemctl enable my-agent.service
352-
sudo systemctl start my-agent.service
353-
```
354-
355-
## Troubleshooting
356-
357-
### Common Issues
358-
359-
**API Key Errors**
360-
```bash
361-
echo $OPENAI_API_KEY # Check environment
362-
tarko --debug # Enable debug mode
363-
```
364-
365-
**Port Conflicts**
366-
```bash
367-
tarko serve --port 3000 # Use different port
368-
lsof -i :8888 # Check port usage
369-
```
370-
371-
**Permission Issues**
372-
```bash
373-
ls -la ./workspace # Check permissions
374-
chmod -R 755 ./workspace # Fix permissions
375-
```
376-
377-
### Debug Mode
378223

379-
```bash
380-
tarko --debug --logLevel debug
381-
tarko --debug run "test" --include-logs
382-
```
383224

384225
## API Reference
385226

386227
Refer to TypeScript definitions:
387228

388-
- `@tarko/agent-interface` - Core agent interfaces
389-
- `@tarko/interface` - Application layer interfaces
390-
- `@tarko/agent-cli` - CLI framework interfaces
229+
- [`@tarko/agent-interface`](https://www.npmjs.com/package/@tarko/agent-interface) - Core agent interfaces
230+
- [`@tarko/interface`](https://www.npmjs.com/package/@tarko/interface) - Application layer interfaces
231+
- [`@tarko/agent-cli`](https://www.npmjs.com/package/@tarko/agent-cli) - CLI framework interfaces
391232

392233
## Examples
393234

0 commit comments

Comments
 (0)