Build¶
Writing DeFi strategies requires deep protocol knowledge, careful risk management, and working code that integrates with on-chain primitives. Almanak Code is a specialized LLM-powered coding agent that understands DeFi concepts like swaps, LP positions, lending, and perpetuals. It reduces the gap from idea to deployable strategy code through natural language conversation.
Build is the second phase of the Almanak Workflow. Signals from Edge feed into the Build workspace, and completed strategies flow into Deploy.
Almanak Code¶
Overview¶
Almanak Code is a conversational coding agent available as a slide-out panel or a fullscreen workspace. It generates, reviews, and iterates on Python strategy code through natural language. Each conversation runs in a persistent session with its own workspace: files created during the session are stored and remain accessible when you return.
Starting a Session¶
Open Almanak Code from the Build section in the navigation or from the dashboard's recent sessions list. You can:
- Create a new session to start from scratch or from a prompt.
- Resume an existing session to continue where you left off, with full message history and workspace files intact.
Sessions persist indefinitely. The compute environment scales to zero after idle periods and spins back up when you return.
Signal-to-Strategy Generation¶
When you trigger Generate Strategy from a signal in Edge, Almanak Code receives the full signal context: alpha score, risk assessment, related tokens, chains, and the detection agent's analysis. It then:
- Generates a strategy PRD (product requirements document) outlining the approach, entry/exit conditions, and risk parameters.
- Produces executable Python code conforming to the Almanak SDK's
IntentStrategyinterface.
This automated pipeline converts a raw market opportunity into a deployable strategy in a single step.
Working with Code¶
The workspace includes a code viewer alongside the chat. As Almanak Code generates or modifies files, they appear in the workspace file browser. You can:
- Review generated code directly in the viewer.
- Ask follow-up questions to refine the strategy logic.
- Request changes to parameters, risk thresholds, or supported chains.
- Iterate until the strategy is ready for deployment or export.
Strategy Library¶
Overview¶
The Strategy Library is a browsable catalog of strategy artifacts. It contains strategies you have created, community-shared strategies from other users, and strategies linked from GitHub repositories.
Strategy Artifacts¶
Each strategy artifact includes:
- Title and description: what the strategy does.
- Author: who created it.
- Agent type and chain support: which execution framework and networks it targets.
- Parameters: configurable inputs with types, default values, and editability flags.
- Version history: previous versions with timestamps.
You can view, clone, or deploy any artifact you have access to.
GitHub Strategies¶
Connect your GitHub account to surface Python strategy repositories in the library. GitHub strategies must include a valid pyproject.toml with the Almanak SDK as a dependency. Once linked, you can:
- Browse available strategies from your repositories.
- Select a specific branch, tag, or commit via the Git ref selector.
- Deploy directly from the library to the Deploy flow.
The platform validates the repository structure before allowing deployment.
If you are developing strategies locally and want to deploy them on Almanak, see Prepare Your Strategy for Deployment for the required repository structure and configuration.