• Townie
    AI
  • Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
abrinz

abrinz

autonomous-val

Public
Like
9
autonomous-val
Home
Code
7
README.md
H
agent.tsx
H
demo.tsx
H
diagram.tsx
prompt.tsx
tools.tsx
utils.tsx
Branches
2
Pull requests
Remixes
5
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
README.md
Code
/
README.md
Search
5/21/2025
Viewing readonly version of main branch: v10
View latest version
README.md

Autonomous Val

This project demonstrates how to build autonomous agents on Val Town that can be triggered by API calls, cron jobs, etc.

Setup

Remix this Val into your Val Town account.

Configure the following variables in your environment:

  • AGENT_API_KEY (This is a secure token that you choose to secure the agent.tsx POST endpoint)
  • OPENAI_API_KEY (An OpenAI API Key)
  • EXA_API_KEY (Optional, though needed if you use the web search tool)

Usage

Use demo.tsx to send objectives to your agent.

API Usage

To use the API from another client, you can POST authenticated requests to the agent.tsx endpoint:

const requestBody = { messages: [ { role: "user", content: "What is the difference in height between the Salesforce Tower and the Empire State Building?" }, ], streamResults: false, }; const response = await fetch("https://<your-val-id>.web.val.run/", { method: "POST", headers: { "Content-Type": "application/json", "Authorization": `Bearer ${Deno.env.get("AGENT_API_KEY")}`, }, body: JSON.stringify(requestBody), });

Streaming Chat

The API will also work with streaming chat front ends based on the Vercel AI SDK's useChat hook.

You just need to pass streamResults: true in your API POST request.

Using Other Models

It is easy to reconfigure the agent to work with other providers that are supported by Vercel's AI SDK.

Learn more: https://ai-sdk.dev/docs/foundations/providers-and-models

Plug

Are you a Senior Software Engineer who wants to work on AI or TypeScript? Feel free to DM me on the Val Town Discord to learn more about careers at AngelList. We're solving some of the hardest problems in Venture Capital and Private Markets and are always looking for great people to join us.

FeaturesVersion controlCode intelligenceCLI
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.