퀵스타트로 첫 에이전트 만들기
퀵스타트로 첫 에이전트 만들기
가장 단순한 에이전트는 컨테이너도 도구도 없이, 프롬프트 하나와 타입이 있는 결과만 있으면 돼요. 컨테이너 샌드박스를 따로 opt-in 하지 않으면, Flue는 모든 에이전트에 가상 샌드박스(virtual sandbox)를 기본으로 써요.
출처: https://github.com/Superintelligent-Group/superintelligent-flue
이 가상 샌드박스는 just-bash로 구현돼요. 에이전트마다 통째로 컨테이너를 띄우는 것보다 훨씬 빠르고 싸고 확장성이 좋아서, 트래픽이 많은 고규모 에이전트에 딱 맞아요.
첫 에이전트는 .flue/agents/ 아래에 TypeScript 파일 하나로 만들 수 있어요. 아래가 그 전형적인 모양이에요.
// .flue/agents/hello-world.ts
import type { FlueContext } from '@flue/runtime';
import * as v from 'valibot';
// Every agent needs a trigger. This agent is invoked as an API endpoint, via HTTP.
export const triggers = { webhook: true };
// The agent handler. Where the orchestration of the agent lives.
export default async function ({ init, payload }: FlueContext) {
// `harness` -- Your initialized harness including sandbox, tools, skills, etc.
const harness = await init({ model: 'anthropic/claude-sonnet-4-6' });
const session = await harness.session();
// prompt() sends a message in the session, triggering action.
const { data } = await session.prompt(`Translate this to ${payload.language}: "${payload.text}"`, {
// Pass a `schema` to get typed, schema-validated data back from your agent.
schema: v.object({
translation: v.string(),
confidence: v.picklist(['low', 'medium', 'high']),
}),
});
return data;
}
짚어 볼 부분이 몇 개 있어요. triggers = { webhook: true }는 이 에이전트가 HTTP 엔드포인트처럼 호출된다는 뜻이에요. init({ model: ... })이 샌드박스와 도구, 스킬을 포함한 하네스를 만들어 주고, session.prompt()가 세션 안에서 메시지를 보내 실행을 일으켜요. 여기에 schema를 넘기면 발리보트(Valibot)로 검증된 타입 있는 데이터를 돌려받아요.
에이전트는 파일 하나로 끝나고, 나머지 판단 로직은 Markdown 안에선 살아요. 이게 Flue 스타일의 코딩 방식이에요.