{"id":"vibeeval-agentica-claude-proxy","name":"agentica-claude-proxy","summary":"Agentica SDKとClaude Code CLIプロキシの統合ガイド","body":"# Agentica-Claude Code Proxy Integration\r\n\r\nUse this skill when developing or debugging the Agentica-Claude proxy integration.\r\n\r\n## When to Use\r\n\r\n- Setting up Agentica agents to use Claude Code tools\r\n- Debugging agent hallucination issues\r\n- Fixing permission errors in file operations\r\n- Understanding the REPL response format\r\n\r\n## Architecture Overview\r\n\r\n```\r\nAgentica Agent → S_M_BASE_URL → Claude Proxy → claude -p → Claude CLI (with tools)\r\n                 (localhost:2345)   (localhost:8080)\r\n```\r\n\r\n## Critical Requirements\r\n\r\n### 1. --allowedTools Flag (REQUIRED)\r\n\r\nClaude CLI in `-p` mode restricts file operations. You MUST add:\r\n\r\n```python\r\nsubprocess.run([\r\n    \"claude\", \"-p\", prompt,\r\n    \"--append-system-prompt\", system_prompt,\r\n    \"--allowedTools\", \"Read\", \"Write\", \"Edit\", \"Bash\",  # REQUIRED\r\n])\r\n```\r\n\r\nWithout this, agents will report \"permission denied\" for Write/Edit operations.\r\n\r\n### 2. SSE Streaming Format (REQUIRED)\r\n\r\nAgentica expects SSE streaming, not plain JSON:\r\n\r\n```python\r\n# Response format\r\nyield f\"data: {json.dumps(chunk)}\\n\\n\"\r\nyield \"data: [DONE]\\n\\n\"\r\n```\r\n\r\n### 3. REPL Response Format (REQUIRED)\r\n\r\nAgents MUST return results as Python code blocks with a return statement:\r\n\r\n```python\r\nreturn \"your result here\"\r\n```\r\n\r\nAgentica's REPL parser extracts code between \\`\\`\\`python and \\`\\`\\`.\r\n\r\n## Anti-Hallucination Prompt Engineering\r\n\r\nAgents will hallucinate success without actually using tools unless you explicitly warn them:\r\n\r\n```\r\n## ANTI-HALLUCINATION WARNING\r\n\r\n**STOP AND READ THIS CAREFULLY:**\r\n\r\nYou have access to these tools: Read, Write, Edit, Bash\r\n\r\nWhen the task asks you to create/modify/run something:\r\n1. FIRST: Actually invoke the tool (Read, Write, Edit, or Bash)\r\n2. SECOND: Wait for the tool result\r\n3. THIRD: Then return your answer based on what actually happened\r\n\r\n**DO NOT** skip the tool invocation and just claim success!\r\n\r\nIf you didn't invoke a tool, you CANNOT claim the action succeeded.\r\n```\r\n\r\n## Path Sandboxing\r\n\r\nBoth Claude Code and Agentica have sandboxes:\r\n\r\n- `/tmp/` paths are blocked by Claude Code\r\n- Files outside project directory blocked by Agentica\r\n\r\n**Solution:** Use project-relative paths like `workspace/` instead of `/tmp/`\r\n\r\n## Debugging\r\n\r\n### Check Agent Logs\r\n\r\n```bash\r\ncat logs/agent-<N>.log\r\n```\r\n\r\nNote: Logs only show final conversational response, not tool invocations.\r\n\r\n### Test Proxy Directly\r\n\r\n```bash\r\ncurl -s http://localhost:8080/v1/chat/completions \\\r\n  -H \"Content-Type: application/json\" \\\r\n  -d '{\"model\": \"claude\", \"messages\": [{\"role\": \"user\", \"content\": \"Create file at workspace/test.txt\"}], \"stream\": false}'\r\n```\r\n\r\n### Verify File Operations\r\n\r\n```bash\r\n# After agent claims to create file\r\nls -la workspace/test.txt\r\ncat workspace/test.txt\r\n```\r\n\r\n## Server Commands\r\n\r\n### Start Servers\r\n\r\n```bash\r\n# Terminal 1: Proxy\r\nuv run python scripts/agentica/claude_proxy.py --port 8080\r\n\r\n# Terminal 2: Agentica Server\r\ncd workspace/agentica-research/agentica-server\r\nINFERENCE_ENDPOINT_URL=http://localhost:8080/v1/chat/completions uv run agentica-server --port 2345\r\n```\r\n\r\n### Use Swarm\r\n\r\n```bash\r\nS_M_BASE_URL=http://localhost:2345 uv run python your_script.py\r\n```\r\n\r\n### Health Checks\r\n\r\n```bash\r\ncurl http://localhost:8080/health  # Proxy\r\ncurl http://localhost:2345/health  # Agentica\r\n```\r\n\r\n## Reference Files\r\n\r\n- Proxy implementation: `scripts/agentica/claude_proxy.py`\r\n- REPL_BASELINE prompt: `scripts/agentica/claude_proxy.py:49-155`\r\n- Comprehensive test: `workspace/test_swarm_all_tools.py`\r\n- DependencySwarm: `scripts/agentica/dependency_swarm.py`\r\n\r\n## Common Errors\r\n\r\n| Error | Cause | Fix |\r\n|-------|-------|-----|\r\n| \"Permission denied\" | Missing --allowedTools | Add `--allowedTools Read Write Edit Bash` |\r\n| Agent claims success but file not created | Hallucination | Add anti-hallucination prompt section |\r\n| \"Cannot access /tmp/...\" | Sandbox restriction | Use project-relative paths |\r\n| \"APIConnectionError\" | Wrong response format | Use SSE streaming (data: {...}\\n\\n) |\r\n| \"NameError: view_file\" | Agent using REPL functions | Add REPL_BASELINE with native tool examples |","author":"@vibeeval","ownerProfile":null,"authorContacts":null,"sourceUrl":"https://github.com/vibeeval/vibecosystem/tree/main/skills/agentica-claude-proxy","license":"MIT","category":"writing","lang":"en","tokens":1013,"stars":0,"calls30d":1,"claimed":false,"visibility":"public","origin":"crawler","version":"0.1.0","createdAt":"2026-08-22","updatedAt":"2026-08-22","files":[],"requires":{"mcp":[],"tools":["Read","Bash"]},"safety":{"flags":[],"scannedAt":"2026-08-22","hasScripts":false,"networkEndpoints":[]}}