fecai

fecai is a Go SDK for building autonomous LLM agents. It provides a vendor-neutral model
abstraction, context compaction for token efficiency, a permission boundary, lifecycle hooks,
and resumable transcripts — the building blocks of a streaming tool-use agent loop that stays
provider- and scenario-agnostic.
Status: pre-v1. The full agent-SDK core is implemented — the vendor-neutral model and
provider adapters, the token-efficiency engine, the tool system, permissions, hooks, compaction,
MCP, memory, skills, plan mode, subagents, multi-agent coordination, the streaming agent loop,
and the public Session. APIs may still change before v1.
Install
go get github.com/inilvinilra/fecai
Requires Go 1.26+.
Packages
| Package |
Status |
Responsibility |
llm |
✅ |
Vendor-neutral message model (Message/ContentBlock/Usage) and Provider interface, with Anthropic, OpenAI, OpenAI-Responses and Ollama adapters; streaming, retry, rate limiting and a response accumulator; non-destructive compaction boundaries and tool-pair repair. |
compaction |
✅ |
Threshold context-window management: micro-compaction, non-destructive boundary summaries, reactive recovery, circuit breaker. |
permission |
✅ |
The safety boundary: allow/deny/ask decisions with deny-priority rules. |
hook |
✅ |
Lifecycle hooks (pre/post tool use, stop, …) that can block, rewrite input or inject context. |
transcript |
✅ |
Append-only JSONL transcripts with session + subagent sidechains and resume. |
condense |
✅ |
Token-efficiency engine: budget governor (USD caps + reserve), tool-result offload, deterministic micro-compaction, a cheap-model summarizer, duplicate-result dedup, a cache-boundary helper, and non-destructive working-set compaction. |
tool |
✅ |
Tool interface, registry and fail-closed factory with a JSON-schema validator; built-ins Read, Write, Edit, MultiEdit, LS, Glob, Grep, Bash, WebFetch, WebSearch, TodoWrite, AskUserQuestion and Sleep; deferred tools (schemas withheld and discovered on demand via ToolSearch) and opt-in background-task tools. |
harness |
✅ |
The streaming agent loop: parallel read-only / serial mutating tool scheduling, permission gating, hooks, compaction, tool_use/tool_result pairing, budget-aware termination, output-cap continuation, max-turns and cancellation. |
mcp |
✅ |
Model Context Protocol stdio JSON-RPC client exposing remote tools as mcp__server__tool. |
memory |
✅ |
Markdown + frontmatter notes with a MEMORY.md index, relevance selection and recall/record tools. |
skill |
✅ |
SKILL.md instruction packs injected as standing guidance, with MCP unlock on invoke. |
plan |
✅ |
Plan mode: ExitPlanMode and a permission-mode transition on approval. |
subagent |
✅ |
An Agent tool that delegates to isolated child loops, with a recursion-depth guard. |
coordinator |
✅ |
Multi-agent orchestration: bounded parallel fan-out to worker subagents. |
agentcore |
✅ |
The public stateful Session (Prompt/Run/Resume) tying everything together. |
Design
- One model, many providers. Adapters translate to and from a single Anthropic-style
content-block representation, so the loop and tools never change when the provider does.
- Token efficiency first. Compaction keeps the model's working context small and relevant
without losing what the agent needs to continue.
- Fail-closed safety. New tools default to approval-required; the host owns the prompt,
the tools and the permission policy.
iter.Seq2 streaming. Range-over-func iterators; cancellation via context.Context.
Examples
See examples/codingagent for a runnable CLI agent built on
agentcore.Session, and the Example in the agentcore package docs for the minimal usage.
Changelog
See CHANGELOG.md.
Contributing & security
See CONTRIBUTING.md and SECURITY.md.
License
Apache-2.0.